Comparing version 1.1.25 to 1.1.26
@@ -26,9 +26,10 @@ (function () { | ||
function pipe(streams, options, callback) { | ||
function pipe(allStreams, options, callback) { | ||
var error, finish, end, | ||
readError, writeError, | ||
last = streams.length - 1, | ||
read = streams[0], | ||
write = streams[last], | ||
streams = allStreams.slice(), | ||
read = streams.shift(), | ||
write = streams.pop(), | ||
rm = function(event, stream, fn) { | ||
@@ -64,3 +65,4 @@ stream.removeListener(event, fn); | ||
callWhenOpen(write, function() { | ||
setListeners(streams, options, onError); | ||
setListeners(streams, onError); | ||
fullPipe(allStreams, options); | ||
}); | ||
@@ -95,3 +97,3 @@ | ||
onEnd(); | ||
} else if (end && (finish || !options.end)) { | ||
} else if (end || finish) { | ||
rm('error', read, onReadError); | ||
@@ -134,8 +136,6 @@ rm('error', write, onWriteError); | ||
function setListeners(streams, options, fn) { | ||
function fullPipe(streams, options) { | ||
var main; | ||
streams.forEach(function(stream) { | ||
stream.on('error', fn); | ||
if (!main) | ||
@@ -150,2 +150,8 @@ main = stream; | ||
function setListeners(streams, fn) { | ||
streams.forEach(function(stream) { | ||
stream.on('error', fn); | ||
}); | ||
} | ||
function unsetListeners(streams, fn) { | ||
@@ -152,0 +158,0 @@ streams.forEach(function(stream) { |
{ | ||
"name": "pipe-io", | ||
"version": "1.1.25", | ||
"version": "1.1.26", | ||
"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
9795
153