ldjson-stream
Advanced tools
Comparing version 1.0.0 to 1.1.0
19
index.js
@@ -9,6 +9,19 @@ var through = require('through2') | ||
function parse() { | ||
return split(function(row) { | ||
function parse(opts) { | ||
opts = opts || {} | ||
opts.strict = opts.strict !== false | ||
function strict(row) { | ||
if (row) return JSON.parse(row) | ||
}) | ||
} | ||
function nonStrict(row) { | ||
try { | ||
if (row) return JSON.parse(row) | ||
} catch(e) { | ||
// ignore | ||
} | ||
} | ||
return opts.strict ? split(strict) : split(nonStrict) | ||
} | ||
@@ -15,0 +28,0 @@ |
{ | ||
"name": "ldjson-stream", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "streaming line delimited json parser + serializer", | ||
@@ -10,3 +10,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"split2": "^0.1.1", | ||
"split2": "^0.1.2", | ||
"through2": "^0.5.1" | ||
@@ -13,0 +13,0 @@ }, |
@@ -26,2 +26,4 @@ # ldjson-stream | ||
If you want to discard non-valid JSON messages, you can call `ldj.parse({strict: false})` | ||
usage: | ||
@@ -28,0 +30,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2498
43
56
Updatedsplit2@^0.1.2