parserblade
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 parserblade
Usage
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('parserblade')
const input = 'title,platform\nStardew Valley,Steam'
const result = csv.parse(input)
console.log(result)
console.log(
csv.stringify(result)
)
YAML
const { yaml } = require('parserblade')
const input = 'title: Stardew Valley\nplatform: Steam'
const result = yaml.parse(input)
console.log(result)
console.log(
yaml.stringify(result)
)
XML
const { xml } = require('parserblade')
const input = '<?xml version="1.0" encoding="utf-8"?><package>lodash</package>'
const result = xml.parse(input)
console.log(result)
console.log(
xml.stringify(result)
)
License
MIT ©