Comparing version 3.0.11 to 3.0.12
@@ -12,3 +12,3 @@ 'use strict'; | ||
options = { | ||
end: true | ||
end: true, | ||
}; | ||
@@ -23,7 +23,10 @@ } else if (typeof options.end === 'undefined') { | ||
pipe(streams, options, callback); | ||
} | ||
}; | ||
function pipe(allStreams, options, callback) { | ||
let error, finish, end; | ||
let readError, writeError; | ||
let error; | ||
let finish; | ||
let end; | ||
let readError; | ||
let writeError; | ||
let writeOpened = false; | ||
@@ -77,7 +80,7 @@ let writeClosed = false; | ||
function onWriteError(error) { | ||
writeError = true; | ||
finish = true; | ||
writeError = true; | ||
finish = true; | ||
read.on('readable', function Readable() { | ||
this.read() | ||
this.read(); | ||
}); | ||
@@ -90,4 +93,4 @@ | ||
function onReadError(error) { | ||
readError = true; | ||
end = true; | ||
readError = true; | ||
end = true; | ||
onError(error); | ||
@@ -110,2 +113,4 @@ onResult(); | ||
destroy(finish, write); | ||
readError = true; | ||
writeError = true; | ||
@@ -122,3 +127,3 @@ if (!end && !finish) | ||
const isWriteOpened = isFsWriteStream ? writeOpened : true; | ||
const bothFinish = end && finish && (isWriteOpened || writeClosed) | ||
const bothFinish = end && finish && (isWriteOpened || writeClosed); | ||
@@ -152,16 +157,18 @@ if (writeError && end) | ||
streams.forEach((stream) => { | ||
if (!main) | ||
return main = stream; | ||
for (const stream of streams) { | ||
if (!main) { | ||
main = stream; | ||
continue; | ||
} | ||
main = main.pipe(stream, { | ||
end: options.end | ||
end: options.end, | ||
}); | ||
}); | ||
} | ||
} | ||
function setListeners(streams, fn) { | ||
streams.forEach((stream) => { | ||
for (const stream of streams) { | ||
stream.on('error', fn); | ||
}); | ||
} | ||
} | ||
@@ -177,6 +184,6 @@ | ||
function unsetListeners(streams, fn) { | ||
streams.forEach((stream) => { | ||
for (const stream of streams) { | ||
stream.removeListener('error', fn); | ||
}); | ||
} | ||
} | ||
{ | ||
"name": "pipe-io", | ||
"version": "3.0.11", | ||
"version": "3.0.12", | ||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", | ||
@@ -16,10 +16,10 @@ "description": "Pipe streams and handle events", | ||
"scripts": { | ||
"test": "tape test/*.js", | ||
"lint": "redrun lint:*", | ||
"lint:lib": "eslint lib", | ||
"lint:test": "eslint -c .eslintrc.test test", | ||
"watch:test": "npm run watcher -- \"npm test\"", | ||
"watcher": "nodemon -w lib -w test -x", | ||
"coverage": "nyc npm test", | ||
"report": "nyc report --reporter=text-lcov | coveralls" | ||
"test": "madrun test", | ||
"fix:lint": "madrun fix:lint", | ||
"lint": "madrun lint", | ||
"lint:test": "madrun lint:test", | ||
"watch:test": "madrun watch:test", | ||
"watcher": "madrun watcher", | ||
"coverage": "madrun coverage", | ||
"report": "madrun report" | ||
}, | ||
@@ -34,16 +34,18 @@ "dependencies": {}, | ||
"coveralls": "^3.0.0", | ||
"eslint": "^5.3.0", | ||
"eslint-plugin-node": "^8.0.0", | ||
"eslint": "^6.4.0", | ||
"eslint-plugin-node": "^10.0.0", | ||
"eslint-plugin-putout": "^2.0.0", | ||
"gunzip-maybe": "^1.4.1", | ||
"madrun": "^3.0.3", | ||
"nodemon": "^1.11.0", | ||
"nyc": "^13.0.1", | ||
"nyc": "^14.1.1", | ||
"pullout": "^3.0.0", | ||
"pump": "^3.0.0", | ||
"putout": "^6.0.0", | ||
"redrun": "^7.0.0", | ||
"tape": "^4.2.0", | ||
"tar-fs": "^1.14.0", | ||
"supertape": "^1.2.3", | ||
"tar-fs": "^2.0.0", | ||
"through2": "^3.0.0", | ||
"try-to-catch": "^1.0.2", | ||
"try-to-tape": "^1.0.0" | ||
"try-to-catch": "^1.0.2" | ||
} | ||
} |
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
13806
140
16