Commit 7d62cdd2 authored by Stefan Penner's avatar Stefan Penner

RSVP.resolve now simply uses the internal resolution procedure

parent 7052bff8
......@@ -5,33 +5,9 @@ function objectOrFunction(x) {
}
function resolve(thenable) {
if (thenable instanceof Promise) {
return thenable;
}
var promise = new Promise(function(resolve, reject) {
var then;
try {
if ( objectOrFunction(thenable) ) {
then = thenable.then;
if (typeof then === "function") {
then.call(thenable, resolve, reject);
} else {
resolve(thenable);
}
} else {
resolve(thenable);
}
} catch(error) {
reject(error);
}
return new Promise(function(resolve, reject) {
resolve(thenable);
});
return promise;
}
export { resolve };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment