Skip to content

Commit

Permalink
stream: remove ambiguous code
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Sep 23, 2019
1 parent 4ef3ccb commit 67be60d
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 67be60d

Please sign in to comment.