@@ -853,19 +853,18 @@ Readable.prototype.wrap = function(stream) {
853853 var state = this . _readableState ;
854854 var paused = false ;
855855
856- var self = this ;
857- stream . on ( 'end' , function ( ) {
856+ stream . on ( 'end' , ( ) => {
858857 debug ( 'wrapped end' ) ;
859858 if ( state . decoder && ! state . ended ) {
860859 var chunk = state . decoder . end ( ) ;
861860 if ( chunk && chunk . length )
862- self . push ( chunk ) ;
861+ this . push ( chunk ) ;
863862 }
864863
865- self . push ( null ) ;
864+ this . push ( null ) ;
866865 } ) ;
867866
868- stream . on ( 'data' , function ( chunk ) {
867+ stream . on ( 'data' , ( chunk ) => {
869868 debug ( 'wrapped data' ) ;
870869 if ( state . decoder )
871870 chunk = state . decoder . write ( chunk ) ;
@@ -876,7 +875,7 @@ Readable.prototype.wrap = function(stream) {
876875 else if ( ! state . objectMode && ( ! chunk || ! chunk . length ) )
877876 return ;
878877
879- var ret = self . push ( chunk ) ;
878+ var ret = this . push ( chunk ) ;
880879 if ( ! ret ) {
881880 paused = true ;
882881 stream . pause ( ) ;
@@ -897,20 +896,20 @@ Readable.prototype.wrap = function(stream) {
897896
898897 // proxy certain important events.
899898 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 ] ) ) ;
901900 }
902901
903902 // when we try to consume some more bytes, simply unpause the
904903 // underlying stream.
905- self . _read = function ( n ) {
904+ this . _read = ( n ) => {
906905 debug ( 'wrapped _read' , n ) ;
907906 if ( paused ) {
908907 paused = false ;
909908 stream . resume ( ) ;
910909 }
911910 } ;
912911
913- return self ;
912+ return this ;
914913} ;
915914
916915
0 commit comments