Comparing version 1.1.17 to 1.1.18
@@ -18,2 +18,5 @@ (function () { | ||
if (typeof options.end === 'undefined') | ||
options.end = true; | ||
assert(streams, 'streams could not be empty!'); | ||
@@ -27,3 +30,7 @@ assert(options, 'callback could not be empty!'); | ||
var error, | ||
read = streams[0]; | ||
isEnd = typeof options.end === 'undefined', | ||
last = streams.length - 1, | ||
read = streams[0], | ||
write = streams[last]; | ||
@@ -34,5 +41,10 @@ read.pause(); | ||
read.on('end', onEnd); | ||
read.on('error', onReadError); | ||
read.on('error', onResultError); | ||
write.on('error', onResultError); | ||
if (options.end || isEnd) | ||
write.on('finish', onEnd); | ||
else | ||
read.on('end', onEnd); | ||
read.resume(); | ||
@@ -44,3 +56,3 @@ | ||
function onReadError(e) { | ||
function onResultError(e) { | ||
error = e; | ||
@@ -52,5 +64,9 @@ onEnd(); | ||
unsetListeners(streams, onError); | ||
read.removeListener('error', onResultError); | ||
read.removeListener('end', onEnd); | ||
read.removeListener('error', onReadError); | ||
write.removeListener('error', onResultError); | ||
write.removeListener('finish', onEnd); | ||
callback(error); | ||
@@ -57,0 +73,0 @@ } |
{ | ||
"name": "pipe-io", | ||
"version": "1.1.17", | ||
"version": "1.1.18", | ||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", | ||
@@ -5,0 +5,0 @@ "description": "Pipe streams and handle events", |
Sorry, the diff of this file is not supported yet
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
7101
94