Skip to content

Commit

Permalink
fixup: state object isDuplex
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Sep 13, 2019
1 parent 35ca570 commit fbec373
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions lib/_stream_writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fbec373

Please sign in to comment.