0.0.2 • Published 13 years ago

knife v0.0.2

Weekly downloads
10
License
-
Repository
github
Last release
13 years ago

knife

Parse JSON that's smushed together

knife

why?

Imagine you have a TCP server that clients are sending JSON to. At fast paces, you can't know if the end of the message is actually the end of the JSON object.

Instead of searching for a delimiter or control character, why not continually parse it?

install

npm install knife

example

var knife = require('knife');

var testObj = {
  lol: 'wut'
}

var goodJSON = JSON.stringify(testObj),
    badJSON = goodJSON + goodJSON;

console.log([
  knife.parse(goodJSON),
  knife.parse(badJSON)
]);

knife.parse(uglyStuff, debug = false)

will always return

{
  results: [ {}, {}, ... ],
  remainder: ''
}
0.0.2

13 years ago

0.0.1

13 years ago

0.0.0

13 years ago