From f7be6ab042059659caa1d5fd18e181f472b33f27 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 14 Jan 2022 16:07:46 -0800 Subject: [PATCH] stream: remove always-false condition check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove comparison to null of variable guaranteed to be a boolean. PR-URL: https://github.com/nodejs/node/pull/41488 Reviewed-By: Matteo Collina Reviewed-By: Benjamin Gruenbaum Reviewed-By: Robert Nagy Reviewed-By: Tobias Nießen Reviewed-By: Darshan Sen --- lib/internal/streams/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/streams/utils.js b/lib/internal/streams/utils.js index 983088e6ba5d0c..d35744f26b7980 100644 --- a/lib/internal/streams/utils.js +++ b/lib/internal/streams/utils.js @@ -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); }