@@ -856,19 +856,18 @@ Readable.prototype.wrap = function(stream) {
856856 var state = this . _readableState ;
857857 var paused = false ;
858858
859- var self = this ;
860- stream . on ( 'end' , function ( ) {
859+ stream . on ( 'end' , ( ) => {
861860 debug ( 'wrapped end' ) ;
862861 if ( state . decoder && ! state . ended ) {
863862 var chunk = state . decoder . end ( ) ;
864863 if ( chunk && chunk . length )
865- self . push ( chunk ) ;
864+ this . push ( chunk ) ;
866865 }
867866
868- self . push ( null ) ;
867+ this . push ( null ) ;
869868 } ) ;
870869
871- stream . on ( 'data' , function ( chunk ) {
870+ stream . on ( 'data' , ( chunk ) => {
872871 debug ( 'wrapped data' ) ;
873872 if ( state . decoder )
874873 chunk = state . decoder . write ( chunk ) ;
@@ -879,7 +878,7 @@ Readable.prototype.wrap = function(stream) {
879878 else if ( ! state . objectMode && ( ! chunk || ! chunk . length ) )
880879 return ;
881880
882- var ret = self . push ( chunk ) ;
881+ var ret = this . push ( chunk ) ;
883882 if ( ! ret ) {
884883 paused = true ;
885884 stream . pause ( ) ;
@@ -900,20 +899,20 @@ Readable.prototype.wrap = function(stream) {
900899
901900 // proxy certain important events.
902901 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 ] ) ) ;
904903 }
905904
906905 // when we try to consume some more bytes, simply unpause the
907906 // underlying stream.
908- self . _read = function ( n ) {
907+ this . _read = ( n ) => {
909908 debug ( 'wrapped _read' , n ) ;
910909 if ( paused ) {
911910 paused = false ;
912911 stream . resume ( ) ;
913912 }
914913 } ;
915914
916- return self ;
915+ return this ;
917916} ;
918917
919918Object . defineProperty ( Readable . prototype , 'readableHighWaterMark' , {
0 commit comments