Package Exports
- parserblade
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (parserblade) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
parser
A all-in-one parser for Javascript, heavily inspired by: https://github.com/nathanmac/Parser. It allows you to work with JSON, XML, CSV and YAML more without worrying about which module install. It's designed to work just as JSON.parse and JSON.stringify does, with some improvements.
Installation
$ npm install --save parserUsage
Every filetype has two main methods: stringify() and parse(), both receives two arguments, data containing any type of data and an options object.
CSV
const { csv } = require('parser')
// Parsing
const input = 'title,platform\nStardew Valley,Steam'
const result = csv.parse(input)
console.log(result) // [ { title: 'Stardew Valley', platform: 'Steam' } ]
// Stringifying
console.log(
csv.stringify(result)
) // 'title,platform\nStardew Valley,Steam'YAML
const { yaml } = require('parser')
// Parsing
const input = 'title: Stardew Valley\nplatform: Steam'
const result = yaml.parse(input)
console.log(result) // { title: 'Stardew Valley', platform: 'Steam' }
// Stringifying
console.log(
yaml.stringify(result)
) // 'title: Stardew Valley\nplatform: Steam'XML
const { xml } = require('parser')
// Parsing
const input = '<?xml version="1.0" encoding="utf-8"?><package>lodash</package>'
const result = xml.parse(input)
console.log(result) // { package: 'lodash' }
// Stringifying
console.log(
xml.stringify(result)
) // '<?xml version="1.0" encoding="utf-8"?><package>lodash</package>'License
MIT ©