1.0.3 • Published 8 years ago

fast-json-parse v1.0.3

Weekly downloads
1,560,274
License
MIT
Repository
github
Last release
8 years ago

fast-json-parse

Build Status

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

The reason why this is fast is that try/catch inhibits the functions in which you use them to be optimized. This assumption holds true up to Node 6, from Node 7 and forward this module is not useful anymore.

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) {
  console.log('unable to parse json', result.err.message)
} else {
  console.log('json parsed successfully', result.value)
}

constructor

'use strict'

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

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

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

Acknowledgements

fast-json-parse is sponsored by nearForm.

License

MIT

endenttowa-servicesmw-hapi-pino@infinitebrahmanuniverse/nolb-fast-@saaspe/components@everything-registry/sub-chunk-1649@wacoco/ystale-multi-cachetheodorejson-log-linejson-schema-middlewarejson-stream-to-objectgulp-parser-apmhttp2-requesthandy-ms-broker-nats@toucansam-bpl/core-utils@vitali_shcherbina/styled-lib@zalastax/nolb-fast-@zerowastemap/bankaiazure-table-loggerartefaktasreaderappa-apiappcharge-checkout@hahahoarder/strawberry-ui@hashtagopen/winston-stackdriveruh-redis-cachetldrawlignintranslation-pickeruspring@livescale/pino-datadog@lego-js/testsmu-tcpmu-httpmultidatmiami-vicenovacap-componentsparvan_componentsparvan_reactjs_componentsserver_api_ggsalus-it600-packsemantic-prettyreact-form-component-librarysessions-provider-redissequelcomponentpkgswapplat-dnspino-logflarepino-pretty-minimistpino-papertrailpino-pretty-expresspino-logglypino-applicationinsightspino-arborsculpturepino-azuretablepino-catch-allpino-clfpino-fluentdpino-gelfpino-gelf-httppino-gelf-testpino-gelf2pino-grigiopino-grispino-comunepino-conepino-couchdbpino-datadogpino-eventhubpino-elasticsearch-awspino-filterpino-coladapino-colada-extpino-spawnpino-stackdriverpino-stackdriver-gkepino-steppino-redispino-syslogpino-teeprevapp_updateprevapp_deleteprevapp_insertprevapp_insert_sincpolyglot-component-librarypure-botsheetify@ogi-it/pino-colada-xl@nppkg/react-dnd@organisme/fastify@omakei/pino-slack-webhook@hypha/web-compiler@img-arena/img-ui-mui-theme@img-arena/ui-core@podlubnaja/ui-kit@petelc/learnstorybook-design-systemgeojsonfilefn-lib-examplefwsp-loggerfuton-mediafuton-media-cli
1.0.3

8 years ago

1.0.2

9 years ago

1.0.1

10 years ago

1.0.0

10 years ago