UNPKG

441 BJavaScriptView Raw
1'use strict';
2var anObject = require('../internals/an-object');
3var isObject = require('../internals/is-object');
4var newPromiseCapability = require('../internals/new-promise-capability');
5
6module.exports = function (C, x) {
7 anObject(C);
8 if (isObject(x) && x.constructor === C) return x;
9 var promiseCapability = newPromiseCapability.f(C);
10 var resolve = promiseCapability.resolve;
11 resolve(x);
12 return promiseCapability.promise;
13};