File tree Expand file tree Collapse file tree 4 files changed +7
-21
lines changed Expand file tree Collapse file tree 4 files changed +7
-21
lines changed Original file line number Diff line number Diff line change @@ -234,17 +234,6 @@ fail.
234234
235235If ` fn ` is not provided, an empty function will be used.
236236
237- ### mustCallAsync([ fn] [ , exact ] )
238- * ` fn ` [ < ; Function>]
239- * ` exact ` [ < ; number>] default = 1
240- * return [ < ; Function>]
241-
242- The same as ` mustCall() ` , except that it is also checked that the Promise
243- returned by the function is fulfilled for each invocation of the function.
244-
245- The return value of the wrapped function is the return value of the original
246- function, if necessary wrapped as a promise.
247-
248237### mustCallAtLeast([ fn] [ , minimum ] )
249238* ` fn ` [ < ; Function>] default = () => {}
250239* ` minimum ` [ < ; number>] default = 1
Original file line number Diff line number Diff line change @@ -308,12 +308,6 @@ function mustCallAtLeast(fn, minimum) {
308308 return _mustCallInner ( fn , minimum , 'minimum' ) ;
309309}
310310
311- function mustCallAsync ( fn , exact ) {
312- return mustCall ( ( ...args ) => {
313- return Promise . resolve ( fn ( ...args ) ) . then ( mustCall ( ( val ) => val ) ) ;
314- } , exact ) ;
315- }
316-
317311function _mustCallInner ( fn , criteria = 1 , field ) {
318312 if ( process . _exiting )
319313 throw new Error ( 'Cannot use common.mustCall*() in process exit handler' ) ;
@@ -721,7 +715,6 @@ module.exports = {
721715 isWindows,
722716 localIPv6Hosts,
723717 mustCall,
724- mustCallAsync,
725718 mustCallAtLeast,
726719 mustNotCall,
727720 nodeProcessAborted,
Original file line number Diff line number Diff line change @@ -26,7 +26,6 @@ const {
2626 allowGlobals,
2727 mustCall,
2828 mustCallAtLeast,
29- mustCallAsync,
3029 hasMultiLocalhost,
3130 skipIfEslintMissing,
3231 canCreateSymLink,
@@ -74,7 +73,6 @@ export {
7473 allowGlobals ,
7574 mustCall ,
7675 mustCallAtLeast ,
77- mustCallAsync ,
7876 hasMultiLocalhost ,
7977 skipIfEslintMissing ,
8078 canCreateSymLink ,
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ const makeDuplexPair = require('../common/duplexpair');
1212{
1313 let req ;
1414 const server = http2 . createServer ( ) ;
15- server . on ( 'stream' , common . mustCallAsync ( async ( stream , headers ) => {
15+ server . on ( 'stream' , mustCallAsync ( async ( stream , headers ) => {
1616 stream . respond ( {
1717 'content-type' : 'text/html' ,
1818 ':status' : 200
@@ -45,3 +45,9 @@ function event(ee, eventName) {
4545 ee . once ( eventName , common . mustCall ( resolve ) ) ;
4646 } ) ;
4747}
48+
49+ function mustCallAsync ( fn , exact ) {
50+ return common . mustCall ( ( ...args ) => {
51+ return Promise . resolve ( fn ( ...args ) ) . then ( common . mustCall ( ( val ) => val ) ) ;
52+ } , exact ) ;
53+ }
You can’t perform that action at this time.
0 commit comments