File tree Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Expand file tree Collapse file tree 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*\()/);
1010var hasToStringTag = require ( 'has-tostringtag/shams' ) ( ) ;
1111var getProto = require ( 'get-proto' ) ;
1212
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' ) ;
2214
2315/** @type {import('.').AsyncFunction | false } */
2416var AsyncFunction ;
You can’t perform that action at this time.
0 commit comments