UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

23 lines (22 loc) 617 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isAsync = isAsync; function isAsync(fn) { const n = 'getMockImplementation'; if (fn?.[n]?.()) { fn = fn[n](); } const firstCheck = fn instanceof (async () => null).constructor; const secondCheck = fn?.constructor?.name === 'AsyncFunction'; if (firstCheck !== secondCheck) { return true; } const isAsyncFunctionBabelTranspiled = fn?.toString()?.trim()?.match(/return _ref[^.]*\.apply/); if (isAsyncFunctionBabelTranspiled) { return true; } return firstCheck; } //# sourceMappingURL=isAsync.js.map