Skip to content

Commit

Permalink
stream: remove always-false condition check
Browse files Browse the repository at this point in the history
Remove comparison to null of variable guaranteed to be a boolean.

PR-URL: #41488
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
  • Loading branch information
Trott authored Jan 15, 2022
1 parent 2ea2621 commit f7be6ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/internal/streams/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ function isReadableFinished(stream, strict) {
function isReadable(stream) {
if (stream && stream[kIsReadable] != null) return stream[kIsReadable];
const r = isReadableNodeStream(stream);
if (r === null || typeof stream?.readable !== 'boolean') return null;
if (typeof stream?.readable !== 'boolean') return null;
if (isDestroyed(stream)) return false;
return r && stream.readable && !isReadableFinished(stream);
}

function isWritable(stream) {
const r = isWritableNodeStream(stream);
if (r === null || typeof stream?.writable !== 'boolean') return null;
if (typeof stream?.writable !== 'boolean') return null;
if (isDestroyed(stream)) return false;
return r && stream.writable && !isWritableEnded(stream);
}
Expand Down

0 comments on commit f7be6ab

Please sign in to comment.