node-stream
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -11,3 +11,8 @@ var map = require('./map.js'); | ||
* | ||
* @returns {Stream} - Transform stream. | ||
* @param {Object} [options] - Options to use when parsing items in the stream. | ||
* @param {Boolean} [options.error = true] - If true, an error caught when parsing JSON | ||
* will be emitted on the stream. If false, the | ||
* unparseable item will be removed from the stream | ||
* without error. | ||
* @returns {Stream} - Transform stream. | ||
* | ||
@@ -27,4 +32,12 @@ * @example | ||
*/ | ||
function parse() { | ||
function parse(options) { | ||
var settings = { | ||
error: true | ||
}; | ||
// Only accept booleans | ||
if (options && (options.error === true || options.error === false)) { | ||
settings.error = options.error; | ||
} | ||
return map(function (chunk, next) { | ||
@@ -36,3 +49,8 @@ var parsed; | ||
} catch (e) { | ||
return next(e); | ||
if (settings.error) { | ||
return next(e); | ||
} | ||
return next(); | ||
} | ||
@@ -39,0 +57,0 @@ |
{ | ||
"name": "node-stream", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Utilities for consuming, creating and manipulating node streams.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -14,3 +14,3 @@ # Node-Stream | ||
A small collection of stream consumers. | ||
A small collection of array-like methods for working with streams. | ||
@@ -17,0 +17,0 @@ ## Install |
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
23043
699