UNPKG

@opra/common

Version:
16 lines (15 loc) 558 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.resolveThunk = resolveThunk; const tslib_1 = require("tslib"); const objects_1 = require("@jsopen/objects"); const putil_promisify_1 = tslib_1.__importDefault(require("putil-promisify")); async function resolveThunk(thunk) { thunk = putil_promisify_1.default.isPromise(thunk) ? await thunk : thunk; if (typeof thunk === 'function') { if ((0, objects_1.isConstructor)(thunk)) return thunk; return await thunk(); } return thunk; }