@ -130,10 +130,10 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
onEofChunk ( stream , state ) ;
onEofChunk ( stream , state ) ;
} else if ( state . objectMode || chunk && chunk . length > 0 ) {
} else if ( state . objectMode || chunk && chunk . length > 0 ) {
if ( state . ended && ! addToFront ) {
if ( state . ended && ! addToFront ) {
var e = new Error ( 'stream.push() after EOF' ) ;
const e = new Error ( 'stream.push() after EOF' ) ;
stream . emit ( 'error' , e ) ;
stream . emit ( 'error' , e ) ;
} else if ( state . endEmitted && addToFront ) {
} else if ( state . endEmitted && addToFront ) {
var e = new Error ( 'stream.unshift() after end event' ) ;
const e = new Error ( 'stream.unshift() after end event' ) ;
stream . emit ( 'error' , e ) ;
stream . emit ( 'error' , e ) ;
} else {
} else {
if ( state . decoder && ! addToFront && ! encoding )
if ( state . decoder && ! addToFront && ! encoding )
@ -640,13 +640,13 @@ Readable.prototype.unpipe = function(dest) {
state . pipesCount = 0 ;
state . pipesCount = 0 ;
state . flowing = false ;
state . flowing = false ;
for ( var i = 0 ; i < len ; i ++ )
for ( let i = 0 ; i < len ; i ++ )
dests [ i ] . emit ( 'unpipe' , this ) ;
dests [ i ] . emit ( 'unpipe' , this ) ;
return this ;
return this ;
}
}
// try to find the right one.
// try to find the right one.
var i = state . pipes . indexOf ( dest ) ;
const i = state . pipes . indexOf ( dest ) ;
if ( i === - 1 )
if ( i === - 1 )
return this ;
return this ;
@ -847,7 +847,7 @@ function fromList(n, state) {
if ( n < list [ 0 ] . length ) {
if ( n < list [ 0 ] . length ) {
// just take a part of the first list item.
// just take a part of the first list item.
// slice is the same for buffers and strings.
// slice is the same for buffers and strings.
var buf = list [ 0 ] ;
const buf = list [ 0 ] ;
ret = buf . slice ( 0 , n ) ;
ret = buf . slice ( 0 , n ) ;
list [ 0 ] = buf . slice ( n ) ;
list [ 0 ] = buf . slice ( n ) ;
} else if ( n === list [ 0 ] . length ) {
} else if ( n === list [ 0 ] . length ) {
@ -863,7 +863,7 @@ function fromList(n, state) {
var c = 0 ;
var c = 0 ;
for ( var i = 0 , l = list . length ; i < l && c < n ; i ++ ) {
for ( var i = 0 , l = list . length ; i < l && c < n ; i ++ ) {
var buf = list [ 0 ] ;
const buf = list [ 0 ] ;
var cpy = Math . min ( n - c , buf . length ) ;
var cpy = Math . min ( n - c , buf . length ) ;
if ( stringMode )
if ( stringMode )