File tree 2 files changed +12
-10
lines changed
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,
@@ -521,9 +522,10 @@ function errorBuffer(state) {
521
522
callback ( new ERR_STREAM_DESTROYED ( 'write' ) ) ;
522
523
}
523
524
524
- for ( const callback of ArrayPrototypeSplice ( state [ kOnFinished ] , 0 ) ) {
525
- callback ( new ERR_STREAM_DESTROYED ( 'end' ) ) ;
526
- }
525
+ ArrayPrototypeForEach (
526
+ ArrayPrototypeSplice ( state [ kOnFinished ] , 0 ) ,
527
+ ( callback ) => callback ( new ERR_STREAM_DESTROYED ( 'end' ) )
528
+ ) ;
527
529
528
530
resetBuffer ( state ) ;
529
531
}
@@ -743,9 +745,8 @@ function finish(stream, state) {
743
745
744
746
state . finished = true ;
745
747
746
- for ( const callback of ArrayPrototypeSplice ( state [ kOnFinished ] , 0 ) ) {
747
- callback ( ) ;
748
- }
748
+ ArrayPrototypeForEach ( ArrayPrototypeSplice ( state [ kOnFinished ] , 0 ) ,
749
+ ( callback ) => callback ( ) ) ;
749
750
750
751
stream . emit ( 'finish' ) ;
751
752
You can’t perform that action at this time.
0 commit comments