# call-me-maybe

> Let your JS API users either give you a callback or receive a promise

Latest version **1.0.2** (published 2022-10-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install call-me-maybe
pnpm add call-me-maybe
yarn add call-me-maybe
bun add call-me-maybe
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-10-31 |
| First published | 2015-09-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 40 |
| Author | Eric McCarthy |
| Maintainers | limulus |
| Keywords | promise, callback, denodeify, promisify, carlyraejepsen |

## Links

- npm: https://www.npmjs.com/package/call-me-maybe
- Repository: https://github.com/limulus/call-me-maybe
- Homepage: https://github.com/limulus/call-me-maybe#readme
- Issues: https://github.com/limulus/call-me-maybe/issues
- npm.io page: https://npm.io/package/call-me-maybe

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2022-10-31
- 1.0.2-beta.1 (beta) — 2022-10-31
- 1.0.1 — 2015-09-12
- 1.0.0 — 2015-09-11

## README

# call-me-maybe [![Continuous Release](https://github.com/limulus/call-me-maybe/actions/workflows/continuous-release.yaml/badge.svg)](https://github.com/limulus/call-me-maybe/actions/workflows/continuous-release.yaml)

Let your JS API users either give you a callback or receive a promise.

## Usage

```javascript
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 `promise` is fulfilled, then it is called with the result of the promise: `cb(null, result)`
  - If `promise` is rejected, then it is called with the rejection error: `cb(err)`

If `cb` is falsey, then `promise` is returned.

---
_Source: https://npm.io/package/call-me-maybe · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
