through2-map
Advanced tools
Comparing version 2.0.0 to 3.0.0
@@ -19,4 +19,8 @@ "use strict"; | ||
if (this.options.wantStrings) chunk = chunk.toString() | ||
this.push(fn.call(this, chunk, this._index++)) | ||
return callback() | ||
try { | ||
this.push(fn.call(this, chunk, this._index++)) | ||
return callback() | ||
} catch (e) { | ||
return callback(e) | ||
} | ||
}) | ||
@@ -23,0 +27,0 @@ Map.prototype._index = 0 |
{ | ||
"name": "through2-map", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "A through2 to create an Array.prototype.map analog for streams.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -199,1 +199,27 @@ "use strict"; | ||
}) | ||
test("error", function (t) { | ||
t.plan(1) | ||
var f = map(function (chunk) { | ||
throw new Error("Error in map function") | ||
}) | ||
function end () { | ||
t.fail("Should not end") | ||
} | ||
var r = spigot([ | ||
"a", | ||
"b", | ||
"cdefghijk", | ||
"lmnopqrst", | ||
"u", | ||
"vwxyz", | ||
]).pipe(f) | ||
.on("end", end) | ||
.on("error", function (err) { | ||
t.true(err instanceof Error, "Caught error") | ||
}) | ||
}) | ||
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
14133
7
228