Skip to content

Commit

Permalink
stream: remove ambiguous code
Browse files Browse the repository at this point in the history
PR-URL: #29664
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
ronag authored and JungMinu committed Sep 29, 2019
1 parent dd74b16 commit ce62e96
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/internal/streams/end-of-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,23 @@ function eos(stream, opts, callback) {
};
}

let readable = opts.readable ||
const readable = opts.readable ||
(opts.readable !== false && isReadable(stream));
let writable = opts.writable ||
const writable = opts.writable ||
(opts.writable !== false && isWritable(stream));

const onlegacyfinish = () => {
if (!stream.writable) onfinish();
};

const onfinish = () => {
writable = false;
writableFinished = true;
if (!readable) callback.call(stream);
if (!readable || readableEnded) callback.call(stream);
};

const onend = () => {
readable = false;
readableEnded = true;
if (!writable) callback.call(stream);
if (!writable || writableFinished) callback.call(stream);
};

const onclose = () => {
Expand Down

0 comments on commit ce62e96

Please sign in to comment.