1 # call-me-maybe [![Build Status](https://travis-ci.org/limulus/call-me-maybe.svg?branch=master)](https://travis-ci.org/limulus/call-me-maybe)
3 Let your JS API users either give you a callback or receive a promise.
8 var maybe = require("call-me-maybe")
10 module.exports = function asyncFunc (cb) {
11 return maybe(cb, new Promise(function(resolve, reject) {
19 ### maybe(cb, promise)
21 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:
23 - If `promise` is fulfilled, then it is called with the result of the promise: `cb(null, result)`
24 - If `promise` is rejected, then it is called with the rejection error: `cb(err)`
26 If `cb` is falsey, then `promise` is retuned.