diff --git a/lib/internal/streams/utils.js b/lib/internal/streams/utils.js index 769eb37749c1b5..1c0b5592597c1d 100644 --- a/lib/internal/streams/utils.js +++ b/lib/internal/streams/utils.js @@ -118,17 +118,19 @@ function isReadableFinished(stream, strict) { function isReadable(stream) { if (stream && stream[kIsReadable] != null) return stream[kIsReadable]; - const r = isReadableNodeStream(stream); if (typeof stream?.readable !== 'boolean') return null; if (isDestroyed(stream)) return false; - return r && stream.readable && !isReadableFinished(stream); + return isReadableNodeStream(stream) && + stream.readable && + !isReadableFinished(stream); } function isWritable(stream) { - const r = isWritableNodeStream(stream); if (typeof stream?.writable !== 'boolean') return null; if (isDestroyed(stream)) return false; - return r && stream.writable && !isWritableEnded(stream); + return isWritableNodeStream(stream) && + stream.writable && + !isWritableEnded(stream); } function isFinished(stream, opts) {