Package Exports
- call-me-maybe
- call-me-maybe/src/maybe.js
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 (call-me-maybe) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
call-me-maybe 
Let your JS API users either give you a callback or receive a promise.
Usage
var maybe = require("call-me-maybe")
module.exports = function asyncFunc (cb) {
return maybe(cb, new Promise(function(resolve, reject) {
// ...
}))
}API
maybe(cb, promise)
If the callback cb is truthy, returns undefined and will call cb when promise is settled. The parameters passed to cb are standard error-first:
- If
promiseis fulfilled, then it is called with the result of the promise:cb(null, result) - If
promiseis rejected, then it is called with the rejection error:cb(err)
If cb is falsey, then promise is returned.