@@ -378,8 +378,8 @@ function readableAddChunk(stream, chunk, encoding, addToFront) {
378
378
if ( ( state . state & kObjectMode ) === 0 ) {
379
379
if ( typeof chunk === 'string' ) {
380
380
encoding = encoding || ( ( state . state & kDefaultUTF8Encoding ) !== 0 ? 'utf8' : state [ kDefaultEncodingValue ] ) ;
381
- if ( ( state . state | kEncoding ) === 0 || state . encoding !== encoding ) {
382
- if ( addToFront && state . encoding ) {
381
+ if ( ( state . state & kEncoding ) === 0 || state . encoding !== encoding ) {
382
+ if ( addToFront && ( state . state & kEncoding ) !== 0 ) {
383
383
// When unshifting, if state.encoding is set, we have to save
384
384
// the string in the BufferList with the state encoding.
385
385
chunk = Buffer . from ( chunk , encoding ) . toString ( state . encoding ) ;
@@ -412,7 +412,7 @@ function readableAddChunk(stream, chunk, encoding, addToFront) {
412
412
return false ;
413
413
else
414
414
addChunk ( stream , state , chunk , true ) ;
415
- } else if ( state . ended ) {
415
+ } else if ( ( state . state & kEnded ) !== 0 ) {
416
416
errorOrDestroy ( stream , new ERR_STREAM_PUSH_AFTER_EOF ( ) ) ;
417
417
} else if ( ( state . state & ( kDestroyed | kErrored ) ) !== 0 ) {
418
418
return false ;
@@ -436,7 +436,7 @@ function readableAddChunk(stream, chunk, encoding, addToFront) {
436
436
// We can push more data if we are below the highWaterMark.
437
437
// Also, if we have no data yet, we can stand some more bytes.
438
438
// This is to work around cases where hwm=0, such as the repl.
439
- return ! state . ended &&
439
+ return ( state . state & kEnded ) === 0 &&
440
440
( state . length < state . highWaterMark || state . length === 0 ) ;
441
441
}
442
442
0 commit comments