@@ -856,19 +856,18 @@ Readable.prototype.wrap = function(stream) {
856
856
var state = this . _readableState ;
857
857
var paused = false ;
858
858
859
- var self = this ;
860
- stream . on ( 'end' , function ( ) {
859
+ stream . on ( 'end' , ( ) => {
861
860
debug ( 'wrapped end' ) ;
862
861
if ( state . decoder && ! state . ended ) {
863
862
var chunk = state . decoder . end ( ) ;
864
863
if ( chunk && chunk . length )
865
- self . push ( chunk ) ;
864
+ this . push ( chunk ) ;
866
865
}
867
866
868
- self . push ( null ) ;
867
+ this . push ( null ) ;
869
868
} ) ;
870
869
871
- stream . on ( 'data' , function ( chunk ) {
870
+ stream . on ( 'data' , ( chunk ) => {
872
871
debug ( 'wrapped data' ) ;
873
872
if ( state . decoder )
874
873
chunk = state . decoder . write ( chunk ) ;
@@ -879,7 +878,7 @@ Readable.prototype.wrap = function(stream) {
879
878
else if ( ! state . objectMode && ( ! chunk || ! chunk . length ) )
880
879
return ;
881
880
882
- var ret = self . push ( chunk ) ;
881
+ var ret = this . push ( chunk ) ;
883
882
if ( ! ret ) {
884
883
paused = true ;
885
884
stream . pause ( ) ;
@@ -900,20 +899,20 @@ Readable.prototype.wrap = function(stream) {
900
899
901
900
// proxy certain important events.
902
901
for ( var n = 0 ; n < kProxyEvents . length ; n ++ ) {
903
- stream . on ( kProxyEvents [ n ] , self . emit . bind ( self , kProxyEvents [ n ] ) ) ;
902
+ stream . on ( kProxyEvents [ n ] , this . emit . bind ( this , kProxyEvents [ n ] ) ) ;
904
903
}
905
904
906
905
// when we try to consume some more bytes, simply unpause the
907
906
// underlying stream.
908
- self . _read = function ( n ) {
907
+ this . _read = ( n ) => {
909
908
debug ( 'wrapped _read' , n ) ;
910
909
if ( paused ) {
911
910
paused = false ;
912
911
stream . resume ( ) ;
913
912
}
914
913
} ;
915
914
916
- return self ;
915
+ return this ;
917
916
} ;
918
917
919
918
Object . defineProperty ( Readable . prototype , 'readableHighWaterMark' , {
0 commit comments