katoikia-app/web-ui/web-react/node_modules/es-abstract/2021/GetPromiseResolve.js

23 lines
692 B
JavaScript
Raw Normal View History

2022-07-06 04:15:11 +00:00
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var Get = require('./Get');
var IsCallable = require('./IsCallable');
var IsConstructor = require('./IsConstructor');
// https://ecma-international.org/ecma-262/12.0/#sec-getpromiseresolve
module.exports = function GetPromiseResolve(promiseConstructor) {
if (!IsConstructor(promiseConstructor)) {
throw new $TypeError('Assertion failed: `promiseConstructor` must be a constructor');
}
var promiseResolve = Get(promiseConstructor, 'resolve');
if (IsCallable(promiseResolve) === false) {
throw new $TypeError('`resolve` method is not callable');
}
return promiseResolve;
};