mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-26 19:54:46 +01:00
22 lines
687 B
JavaScript
22 lines
687 B
JavaScript
'use strict';
|
|
|
|
var GetIntrinsic = require('get-intrinsic');
|
|
|
|
var $TypeError = GetIntrinsic('%TypeError%');
|
|
|
|
var Get = require('./Get');
|
|
var IsCallable = require('./IsCallable');
|
|
var IsConstructor = require('./IsConstructor');
|
|
|
|
// https://262.ecma-international.org/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;
|
|
};
|