Wrap and unwrap thenables so that you can pass them through promises
$ npm install thenable
Return a Wrapped
object for that thenable
If obj
is a Wrapped
return the thenable that obj
wraps, else return obj
.
Return the thenable being wrapped.
promise
.then(function () {
return thenable.wrap(A);
})
.then(function (a) {
assert(thenable.unwrap(a) === A);
assert(a.unwrap() === A);
return 'foo';
})
.then(function (foo) {
assert(thenable.unwrap(foo) === 'foo');
});
MIT