Socket
Socket
Sign inDemoInstall

parserblade

Package Overview
Dependencies
12
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    parserblade

The easiest parser for JSON, XML, CSV and YAML. Use it as simple as JSON.stringify() or JSON.parse(). All in one place.


Version published
Weekly downloads
1
Maintainers
1
Install size
2.86 MB
Created
Weekly downloads
 

Readme

Source

parserblade

CI

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.

See docs for more info and examples.

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')

// 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('parserblade')

// 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('parserblade')

// 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 ©

Keywords

FAQs

Last updated on 17 Sep 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc