File tree Expand file tree Collapse file tree 2 files changed +2
-10
lines changed Expand file tree Collapse file tree 2 files changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -7,20 +7,12 @@ const {
77 ERR_INVALID_ARG_TYPE ,
88 ERR_STREAM_PREMATURE_CLOSE
99} = require ( 'internal/errors' ) . codes ;
10+ const { once } = require ( 'internal/util' ) ;
1011
1112function isRequest ( stream ) {
1213 return stream . setHeader && typeof stream . abort === 'function' ;
1314}
1415
15- function once ( callback ) {
16- let called = false ;
17- return function ( err ) {
18- if ( called ) return ;
19- called = true ;
20- callback . call ( this , err ) ;
21- } ;
22- }
23-
2416function eos ( stream , opts , callback ) {
2517 if ( arguments . length === 2 ) {
2618 callback = opts ;
Original file line number Diff line number Diff line change @@ -375,7 +375,7 @@ function once(callback) {
375375 return function ( ...args ) {
376376 if ( called ) return ;
377377 called = true ;
378- callback ( ... args ) ;
378+ callback . apply ( this , args ) ;
379379 } ;
380380}
381381
You can’t perform that action at this time.
0 commit comments