1 | ;
|
2 | var anObject = require('../internals/an-object');
|
3 | var isObject = require('../internals/is-object');
|
4 | var newPromiseCapability = require('../internals/new-promise-capability');
|
5 |
|
6 | module.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 | };
|