File tree Expand file tree Collapse file tree 5 files changed +8
-27
lines changed Expand file tree Collapse file tree 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+
13declare namespace isAsyncFunction {
2- type AsyncFunction = ( ... args : any [ ] ) => Promise < any >
4+ export type { AsyncFunction } ;
35}
46
5- declare function isAsyncFunction ( fn : unknown ) : fn is isAsyncFunction . AsyncFunction ;
7+ declare function isAsyncFunction ( fn : unknown ) : fn is AsyncFunction ;
68
79export = isAsyncFunction ;
Original file line number Diff line number Diff line change @@ -10,10 +10,7 @@ var isFnRegex = safeRegexTest(/^\s*async(?:\s+function(?:\s+|\()|\s*\()/);
1010var hasToStringTag = require ( 'has-tostringtag/shams' ) ( ) ;
1111var getProto = require ( 'get-proto' ) ;
1212
13- var getAsyncFunc = require ( './getAsyncFunc' ) ;
14-
15- /** @type {import('.').AsyncFunction | false } */
16- var AsyncFunction ;
13+ var getAsyncFunc = require ( 'async-function' ) ;
1714
1815/** @type {import('.') } */
1916module . exports = function isAsyncFunction ( fn ) {
@@ -30,10 +27,6 @@ module.exports = function isAsyncFunction(fn) {
3027 if ( ! getProto ) {
3128 return false ;
3229 }
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 ) ;
3932} ;
Original file line number Diff line number Diff line change 4545 "url" : " https://github.com/inspect-js/is-async-function/issues"
4646 },
4747 "dependencies" : {
48+ "async-function" : " ^1.0.0" ,
4849 "call-bound" : " ^1.0.3" ,
4950 "get-proto" : " ^1.0.1" ,
5051 "has-tostringtag" : " ^1.0.2" ,
You can’t perform that action at this time.
0 commit comments