stream: remove always-false condition check
Remove comparison to null of variable guaranteed to be a boolean. PR-URL: https://github.com/nodejs/node/pull/41488 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
parent
2ea2621ace
commit
f7be6ab042
@ -119,14 +119,14 @@ function isReadableFinished(stream, strict) {
|
|||||||
function isReadable(stream) {
|
function isReadable(stream) {
|
||||||
if (stream && stream[kIsReadable] != null) return stream[kIsReadable];
|
if (stream && stream[kIsReadable] != null) return stream[kIsReadable];
|
||||||
const r = isReadableNodeStream(stream);
|
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;
|
if (isDestroyed(stream)) return false;
|
||||||
return r && stream.readable && !isReadableFinished(stream);
|
return r && stream.readable && !isReadableFinished(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isWritable(stream) {
|
function isWritable(stream) {
|
||||||
const r = isWritableNodeStream(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;
|
if (isDestroyed(stream)) return false;
|
||||||
return r && stream.writable && !isWritableEnded(stream);
|
return r && stream.writable && !isWritableEnded(stream);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user