File tree 5 files changed +8
-27
lines changed
5 files changed +8
-27
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import type { AsyncFunction } from 'async-function' ;
2
+
1
3
declare namespace isAsyncFunction {
2
- type AsyncFunction = ( ... args : any [ ] ) => Promise < any >
4
+ export type { AsyncFunction } ;
3
5
}
4
6
5
- declare function isAsyncFunction ( fn : unknown ) : fn is isAsyncFunction . AsyncFunction ;
7
+ declare function isAsyncFunction ( fn : unknown ) : fn is AsyncFunction ;
6
8
7
9
export = isAsyncFunction ;
Original file line number Diff line number Diff line change @@ -10,10 +10,7 @@ var isFnRegex = safeRegexTest(/^\s*async(?:\s+function(?:\s+|\()|\s*\()/);
10
10
var hasToStringTag = require ( 'has-tostringtag/shams' ) ( ) ;
11
11
var getProto = require ( 'get-proto' ) ;
12
12
13
- var getAsyncFunc = require ( './getAsyncFunc' ) ;
14
-
15
- /** @type {import('.').AsyncFunction | false } */
16
- var AsyncFunction ;
13
+ var getAsyncFunc = require ( 'async-function' ) ;
17
14
18
15
/** @type {import('.') } */
19
16
module . exports = function isAsyncFunction ( fn ) {
@@ -30,10 +27,6 @@ module.exports = function isAsyncFunction(fn) {
30
27
if ( ! getProto ) {
31
28
return false ;
32
29
}
33
- if ( typeof AsyncFunction === 'undefined' ) {
34
- var asyncFunc = getAsyncFunc ( ) ;
35
- // eslint-disable-next-line no-extra-parens
36
- AsyncFunction = asyncFunc ? /** @type {import('.').AsyncFunction } */ ( getProto ( asyncFunc ) ) : false ;
37
- }
38
- return AsyncFunction && getProto ( fn ) === AsyncFunction ;
30
+ var asyncFunc = getAsyncFunc ( ) ;
31
+ return asyncFunc && asyncFunc . prototype === getProto ( fn ) ;
39
32
} ;
Original file line number Diff line number Diff line change 45
45
"url" : " https://github.com/inspect-js/is-async-function/issues"
46
46
},
47
47
"dependencies" : {
48
+ "async-function" : " ^1.0.0" ,
48
49
"call-bound" : " ^1.0.3" ,
49
50
"get-proto" : " ^1.0.1" ,
50
51
"has-tostringtag" : " ^1.0.2" ,
You can’t perform that action at this time.
0 commit comments