Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clarinet

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clarinet - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

bench/results/dscape-study/BD_dscape.sav

4

bench/async.js

@@ -61,2 +61,6 @@ // forked from github.com/creationix/jsonparse

//
// if anyone wants to implement it in async this is how (creationix
// as fixed the module and provided a example:
// https://gist.github.com/1506454
//
//function jsonparse_bench(cb) {

@@ -63,0 +67,0 @@ // jsonparser = new Parser();

4

clarinet.js

@@ -280,3 +280,3 @@ ;(function (clarinet) {

if (clarinet.DEBUG) console.log(i,c,clarinet.STATE[parser.state],p);
if (clarinet.DEBUG) console.log(i,c,clarinet.STATE[parser.state]);
parser.position ++;

@@ -383,2 +383,4 @@ if (c === "\n") {

while (c) {
if (clarinet.DEBUG)
console.log(i,c,clarinet.STATE[parser.state]);
// if it seems like end of string

@@ -385,0 +387,0 @@ // and we found slashes before

@@ -5,3 +5,3 @@ { "name" : "clarinet"

, "author" : "Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com/)"
, "version" : "0.5.1"
, "version" : "0.5.2"
, "main" : "./clarinet.js"

@@ -8,0 +8,0 @@ , "homepage" : "https://github.com/dscape/clarinet"

# clarinet
`clarinet` is a sax-like streaming parser for JSON (pun intended). works in the browser and node.js. `clarinet` is inspired (and forked) from [sax-js][saxjs]. just like you shouldn't use `sax` when you need `dom` you shouldn't use `clarinet` when you need `JSON.parse`.
`clarinet` is a sax-like streaming parser for JSON. works in the browser and node.js. `clarinet` is inspired (and forked) from [sax-js][saxjs]. just like you shouldn't use `sax` when you need `dom` you shouldn't use `clarinet` when you need `JSON.parse`. for a more detailed introduction and a performance study please refer to this [article][blog].

@@ -128,6 +128,6 @@ # design goals

`closed` - Boolean indicating whether or not the parser can be written to.
If it's `true`, then wait for the `ready` event to write again.
`closed` - boolean indicating whether or not the parser can be written to.
if it's `true`, then wait for the `ready` event to write again.
`opt` - Any options passed into the constructor.
`opt` - any options passed into the constructor.

@@ -170,3 +170,3 @@ and a bunch of other stuff that you probably shouldn't touch.

added some [samples] to help you get started. one that creates a list of top npm contributors, and another that gets a bunch of data from twitter and generates valid json. first sample is a good use for `clarinet`, second not so much. i just needed data and this was a good way to battle test it. but the `twitter` sample is a good example of when not to use `clarinet`. http requests take forever and you had more than enough time to `JSON.parse`. so what i did is stupid.
some [samples] are available to help you get started. one that creates a list of top npm contributors, and another that gets a bunch of data from twitter and generates valid json.

@@ -199,13 +199,2 @@ # roadmap

this is not ideal so if you improve it send a pull request.
# differences to yajl
* `yajl` is written in c, probably won't work in the browser
* `clarinet` does not do validations.
* `openobject` emits the name of the first key, while in `yajl` the first key emit is separated
* `clarinet` emits `value` for any value. `yajl` emits `string` for string, `null` for null, and so on.
if these differences bother you feel free to send in a pull request.
# meta

@@ -225,2 +214,3 @@

[yajl]: https://github.com/lloyd/yajl
[samples]: https://github.com/dscape/clarinet/tree/master/samples
[samples]: https://github.com/dscape/clarinet/tree/master/samples
[blog]: http://writings.nunojob.com/2011/12/clarinet-sax-based-evented-streaming-json-parser-in-javascript-for-the-browser-and-nodejs.html
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc