From fbec373ffdb32f8e404bc674adbbcadf08c8eb3b Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Thu, 12 Sep 2019 15:14:41 +0200 Subject: [PATCH] fixup: state object isDuplex --- lib/_stream_readable.js | 3 +++ lib/_stream_writable.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 02f669a0eab79e..ac749c2710a16d 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -73,6 +73,9 @@ function prependListener(emitter, event, fn) { } function ReadableState(options, isDuplex) { + if (typeof isDuplex !== 'boolean') + isDuplex = stream instanceof Stream.Duplex; + // Object stream flag. Used to make read(n) ignore n and to // make all the buffer merging and length checks go away this.objectMode = !!(options && options.objectMode); diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index c5fdec065d73af..7fdb748dcb80fc 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -58,6 +58,9 @@ Object.setPrototypeOf(Writable, Stream); function nop() {} function WritableState(options, stream, isDuplex) { + if (typeof isDuplex !== 'boolean') + isDuplex = stream instanceof Stream.Duplex; + // Object stream flag to indicate whether or not this stream // contains buffers or objects. this.objectMode = !!(options && options.objectMode);