Skip to content
Prev Previous commit
Next Next commit
fixup! unify conditions
  • Loading branch information
debadree25 committed Feb 17, 2023
commit 183f47517885c9981517718d12eb2b763d270c49
28 changes: 10 additions & 18 deletions lib/internal/streams/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,24 +166,16 @@ module.exports = function compose(...streams) {
}
};
}
if (isNodeStream(tail)) {
tail.on('finish', function() {
if (onfinish) {
const cb = onfinish;
onfinish = null;
cb();
}
});
} else if (isWebStream(tail)) {
const readable = isTransformStream(tail) ? tail.readable : tail;
eos(readable, () => {
if (onfinish) {
const cb = onfinish;
onfinish = null;
cb();
}
});
}

const toRead = isTransformStream(tail) ? tail.readable : tail;

eos(toRead, () => {
if (onfinish) {
const cb = onfinish;
onfinish = null;
cb();
}
});
}

if (readable) {
Expand Down