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