PromiseResolve.js 506 B

123456789101112131415161718
  1. 'use strict';
  2. var GetIntrinsic = require('get-intrinsic');
  3. var callBind = require('call-bind');
  4. var $SyntaxError = require('es-errors/syntax');
  5. var $resolve = GetIntrinsic('%Promise.resolve%', true);
  6. var $PromiseResolve = $resolve && callBind($resolve);
  7. // https://262.ecma-international.org/9.0/#sec-promise-resolve
  8. module.exports = function PromiseResolve(C, x) {
  9. if (!$PromiseResolve) {
  10. throw new $SyntaxError('This environment does not support Promises.');
  11. }
  12. return $PromiseResolve(C, x);
  13. };