Package Exports
- promise-resolver
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (promise-resolver) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
promise-resolver 
Turn a promises resolver methods into a node style callback
Install
$ npm install --save promise-resolver
Usage
var promiseResolver = require('promise-resolver');
new Promise(function (resolve, reject) {
var cb = promiseResolver(resolve, reject, passThroughCallback);
cb(new Error('...')); // rejects promise and calls passThroughCallback with same args
cb(null, 'result'); // resolves promise and calls passThroughCallback with same args
});
API
promiseResolver(resolve, reject, passThrough)
All arguments should be functions, null, or undefined.
resolve
- promise resolve functionreject
- promise reject functionpassThrough
- a "pass through" node style (error first) callback.
Returns a node style callback: cb(err, result...)
Calling the callback will resolve or reject the promise (depending on the err
argument).
If it exists, the passThrough
callback will be called with the same arguments.
License
MIT © James Talmage