From 5e890be36023c025e1d9ec45489726a8e7fe94d3 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 736b6e1ab0adb3..67550553515911 100644 --- a/lib/internal/streams/utils.js +++ b/lib/internal/streams/utils.js @@ -123,14 +123,14 @@ function isDisturbed(stream) { 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); }