JSPM

fast-json-parse

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4249515
  • Score
    100M100P100Q208492F
  • License MIT

Parse json safely and at max speed

Package Exports

  • fast-json-parse

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 (fast-json-parse) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fast-json-parse

Build Status

It is equivalent to json-parse-safe, but it set both the err and value property to null.

Install

npm i fast-json-parse --save

Usage

You can use it as a function or via a contructor, as you prefer.

function

'use strict'

var parse = require('fast-json-parse')
var fs = require('fs')

var result = parse(fs.readFileSync('./package.json'))

if (result.err) {
  // unable to parse json
  console.log(err.message)
} else {
  console.log('json parsed successfully')
}

constructor

'use strict'

var Parse = require('fast-json-parse')
var fs = require('fs')

var result = new Parse(fs.readFileSync('./package.json'))

if (result.err) {
  // unable to parse json
  console.log(err.message)
} else {
  console.log('json parsed successfully')
}

Acknowledgements

fast-json-parse is sponsored by nearForm.

License

MIT