Compare commits

...

2 Commits

@ -16,13 +16,17 @@ module.exports = function pipe(streams) {
function getPipeline(source) {
if (!boundPipelineCache.has(source)) {
let pipeline = existentStreams.reduce((bound, stream) => {
if (stream.read == null) {
throw new Error(`Stream is missing a read handler (stream description: ${stream.description})`);
let pipeline = existentStreams.reduce((bound, stream, i) => {
// TODO: Use Validatem for this instead
// FIXME: Stream index is currently wrong if there were any nulls in the streams list, correct for this
if (!(typeof stream === "object") || Array.isArray(stream)) {
throw new Error(`Value at index ${i} in the pipeline is not a stream`);
} else if (stream.read == null) {
throw new Error(`Stream at index ${i} is missing a read handler (stream description: ${stream.description})`);
} else if (stream.abort == null) {
throw new Error(`Stream is missing an abort handler (stream description: ${stream.description})`);
throw new Error(`Stream at index ${i} is missing an abort handler (stream description: ${stream.description})`);
} else if (stream.peek == null) {
throw new Error(`Stream is missing a peek handler (stream description: ${stream.description})`);
throw new Error(`Stream at index ${i} is missing a peek handler (stream description: ${stream.description})`);
} else {
if (bound != null) {
return Object.assign({}, stream, {

@ -1,6 +1,6 @@
{
"name": "@promistream/pipe",
"version": "0.1.2",
"version": "0.1.3",
"main": "index.js",
"repository": "http://git.cryto.net/promistream/pipe.git",
"author": "Sven Slootweg <admin@cryto.net>",

Loading…
Cancel
Save