You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
692 B
23 lines
692 B
2 years ago
|
'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;
|
||
|
};
|