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 22
22
'use strict' ;
23
23
24
24
const {
25
+ ArrayPrototypeForEach,
25
26
ArrayPrototypeIndexOf,
26
27
ArrayPrototypePush,
27
28
ArrayPrototypeSplice,
@@ -854,8 +855,8 @@ Readable.prototype.unpipe = function(dest) {
854
855
state . pipes = [ ] ;
855
856
this . pause ( ) ;
856
857
857
- for ( const dest of dests )
858
- dest . emit ( 'unpipe' , this , { hasUnpiped : false } ) ;
858
+ ArrayPrototypeForEach ( dests , ( dest ) =>
859
+ dest . emit ( 'unpipe' , this , { hasUnpiped : false } ) ) ;
859
860
return this ;
860
861
}
861
862
@@ -1056,11 +1057,11 @@ Readable.prototype.wrap = function(stream) {
1056
1057
} ;
1057
1058
1058
1059
// Proxy all the other methods. Important when wrapping filters and duplexes.
1059
- for ( const i of ObjectKeys ( stream ) ) {
1060
+ ArrayPrototypeForEach ( ObjectKeys ( stream ) , ( i ) => {
1060
1061
if ( this [ i ] === undefined && typeof stream [ i ] === 'function' ) {
1061
1062
this [ i ] = FunctionPrototypeBind ( stream [ i ] , stream ) ;
1062
1063
}
1063
- }
1064
+ } ) ;
1064
1065
1065
1066
return this ;
1066
1067
} ;
Original file line number Diff line number Diff line change 26
26
'use strict' ;
27
27
28
28
const {
29
+ ArrayPrototypeForEach,
29
30
ArrayPrototypePush,
30
31
ArrayPrototypeSlice,
31
32
ArrayPrototypeSplice,
@@ -522,9 +523,10 @@ function errorBuffer(state) {
522
523
callback ( new ERR_STREAM_DESTROYED ( 'write' ) ) ;
523
524
}
524
525
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
+ ) ;
528
530
529
531
resetBuffer ( state ) ;
530
532
}
@@ -744,9 +746,8 @@ function finish(stream, state) {
744
746
745
747
state . finished = true ;
746
748
747
- for ( const callback of ArrayPrototypeSplice ( state [ kOnFinished ] , 0 ) ) {
748
- callback ( ) ;
749
- }
749
+ ArrayPrototypeForEach ( ArrayPrototypeSplice ( state [ kOnFinished ] , 0 ) ,
750
+ ( callback ) => callback ( ) ) ;
750
751
751
752
stream . emit ( 'finish' ) ;
752
753
You can’t perform that action at this time.
0 commit comments