File tree 3 files changed +16
-9
lines changed
3 files changed +16
-9
lines changed Original file line number Diff line number Diff line change
1
+ import type { AsyncFunction } from '.' ;
2
+
3
+ declare function getAsyncFunc ( ) : AsyncFunction | false ;
4
+
5
+ export = getAsyncFunc ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ /** @type {import('./getAsyncFunc') } */
4
+ module . exports = function ( ) {
5
+ try {
6
+ return Function ( 'return async function () {}' ) ( ) ;
7
+ } catch ( e ) {
8
+ return false ;
9
+ }
10
+ } ;
Original file line number Diff line number Diff line change @@ -10,15 +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 = function ( ) { // eslint-disable-line consistent-return
14
- if ( ! hasToStringTag ) {
15
- return false ;
16
- }
17
- try {
18
- return Function ( 'return async function () {}' ) ( ) ;
19
- } catch ( e ) {
20
- }
21
- } ;
13
+ var getAsyncFunc = require ( './getAsyncFunc' ) ;
22
14
23
15
/** @type {import('.').AsyncFunction | false } */
24
16
var AsyncFunction ;
You can’t perform that action at this time.
0 commit comments