Package Exports
- thenify
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 (thenify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
thenify
Promisify a callback-based function.
- Preserves function names
- Uses a native promise implementation if available and tries to fall back to
bluebird
- Converts multiple arguments from the callback into an
Array
- Resulting function never deoptimizes
An added benefit is that throw
n errors in that async function will be caught by the promise!
API
var thenify = require('thenify');
var somethingAsync = thenify(function somethingAsync(a, b, c, callback) {
callback(null, a, b, c);
});
var fn = thenify([name], fn)
Promisifies a function.
Optionally set a custom name to the function,
defaulting to fn.name
.