File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed
Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change 2222'use strict' ;
2323
2424const {
25+ ArrayPrototypeForEach,
2526 ArrayPrototypeIndexOf,
2627 ArrayPrototypePush,
2728 ArrayPrototypeSplice,
@@ -854,8 +855,8 @@ Readable.prototype.unpipe = function(dest) {
854855 state . pipes = [ ] ;
855856 this . pause ( ) ;
856857
857- for ( const dest of dests )
858- dest . emit ( 'unpipe' , this , { hasUnpiped : false } ) ;
858+ ArrayPrototypeForEach ( dests , ( dest ) =>
859+ dest . emit ( 'unpipe' , this , { hasUnpiped : false } ) ) ;
859860 return this ;
860861 }
861862
@@ -1056,11 +1057,11 @@ Readable.prototype.wrap = function(stream) {
10561057 } ;
10571058
10581059 // Proxy all the other methods. Important when wrapping filters and duplexes.
1059- for ( const i of ObjectKeys ( stream ) ) {
1060+ ArrayPrototypeForEach ( ObjectKeys ( stream ) , ( i ) => {
10601061 if ( this [ i ] === undefined && typeof stream [ i ] === 'function' ) {
10611062 this [ i ] = FunctionPrototypeBind ( stream [ i ] , stream ) ;
10621063 }
1063- }
1064+ } ) ;
10641065
10651066 return this ;
10661067} ;
Original file line number Diff line number Diff line change 2626'use strict' ;
2727
2828const {
29+ ArrayPrototypeForEach,
2930 ArrayPrototypePush,
3031 ArrayPrototypeSlice,
3132 ArrayPrototypeSplice,
@@ -522,9 +523,10 @@ function errorBuffer(state) {
522523 callback ( new ERR_STREAM_DESTROYED ( 'write' ) ) ;
523524 }
524525
525- for ( const callback of ArrayPrototypeSplice ( state [ kOnFinished ] , 0 ) ) {
526- callback ( new ERR_STREAM_DESTROYED ( 'end' ) ) ;
527- }
526+ ArrayPrototypeForEach (
527+ ArrayPrototypeSplice ( state [ kOnFinished ] , 0 ) ,
528+ ( callback ) => callback ( new ERR_STREAM_DESTROYED ( 'end' ) )
529+ ) ;
528530
529531 resetBuffer ( state ) ;
530532}
@@ -744,9 +746,8 @@ function finish(stream, state) {
744746
745747 state . finished = true ;
746748
747- for ( const callback of ArrayPrototypeSplice ( state [ kOnFinished ] , 0 ) ) {
748- callback ( ) ;
749- }
749+ ArrayPrototypeForEach ( ArrayPrototypeSplice ( state [ kOnFinished ] , 0 ) ,
750+ ( callback ) => callback ( ) ) ;
750751
751752 stream . emit ( 'finish' ) ;
752753
You can’t perform that action at this time.
0 commit comments