es.promise.resolve.js 838 B

123456789101112131415161718
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var getBuiltIn = require('../internals/get-built-in');
  4. var IS_PURE = require('../internals/is-pure');
  5. var NativePromiseConstructor = require('../internals/promise-native-constructor');
  6. var FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;
  7. var promiseResolve = require('../internals/promise-resolve');
  8. var PromiseConstructorWrapper = getBuiltIn('Promise');
  9. var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;
  10. // `Promise.resolve` method
  11. // https://tc39.es/ecma262/#sec-promise.resolve
  12. $({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, {
  13. resolve: function resolve(x) {
  14. return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);
  15. }
  16. });