# cb2promise

> Converts whatever standard NodeJS callback function into ES6 standard promise.

Latest version **1.1.1** (published 2019-03-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install cb2promise
pnpm add cb2promise
yarn add cb2promise
bun add cb2promise
```

## 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.1.1 |
| Published | 2019-03-08 |
| First published | 2015-07-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 4 |
| Dependencies | 2 |
| Unpacked size | 9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Kiko Beats |
| Maintainers | kikobeats |
| Keywords | ES6, callback, cb, converter, promise, standard |

## Links

- npm: https://www.npmjs.com/package/cb2promise
- Repository: https://github.com/kikobeats/cb2promise
- Homepage: https://github.com/Kikobeats/cb2promise
- Issues: https://github.com/Kikobeats/cb2promise/issues
- npm.io page: https://npm.io/package/cb2promise

## Dependencies (2)

- [sliced](https://npm.io/package/sliced.md) ~1.0.1
- [mimic-fn](https://npm.io/package/mimic-fn.md) ~2.0.0

## 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.1.1 (latest) — 2019-03-08
- 1.1.0 — 2017-04-28
- 1.0.7 — 2017-04-28
- 1.0.6 — 2017-04-27
- 1.0.5 — 2017-03-02
- 1.0.4 — 2017-03-02
- 1.0.3 — 2017-02-07
- 1.0.2 — 2015-10-06
- 1.0.1 — 2015-07-28
- 1.0.0 — 2015-07-28

## README

# cb2promise

![Last version](https://img.shields.io/github/tag/Kikobeats/cb2promise.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/Kikobeats/cb2promise/master.svg?style=flat-square)](https://travis-ci.org/Kikobeats/cb2promise)
[![Coverage Status](https://img.shields.io/coveralls/Kikobeats/cb2promise.svg?style=flat-square)](https://coveralls.io/github/Kikobeats/cb2promise)
[![Dependency status](https://img.shields.io/david/Kikobeats/cb2promise.svg?style=flat-square)](https://david-dm.org/Kikobeats/cb2promise)
[![Dev Dependencies Status](https://img.shields.io/david/dev/Kikobeats/cb2promise.svg?style=flat-square)](https://david-dm.org/Kikobeats/cb2promise#info=devDependencies)
[![NPM Status](https://img.shields.io/npm/dm/cb2promise.svg?style=flat-square)](https://www.npmjs.org/package/cb2promise)
[![Donate](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square)](https://paypal.me/Kikobeats)

> It converts from standard NodeJS callback into a ES2015 Promise.

I use this library across my project for make easy provide API's that works with callback and promise style.

## Install

```bash
npm install cb2promise --save
```

## Bencharmk

```bash
$ node benchmark.js

# cb2promise
# 1,2,3,4,5,6,7,8,8,9,10
ok ~2.65 ms (0 s + 2649092 ns)

# pify
# 1
ok ~912 μs (0 s + 911730 ns)

# es6-promisify
# 1
ok ~967 μs (0 s + 966663 ns)

# bluebird
# 1
ok ~3.41 ms (0 s + 3412077 ns)

all benchmarks completed
ok ~7.94 ms (0 s + 7939562 ns)
```

## Usage

```js
const cb2promise = require('cb2promise')

const callbackFn = function (message, done) {
  return done(null, message)
}

const promise = cb2promise(callbackFn, 'hello world')

promise().then(console.log)
// => hello world
```

## License

MIT © [Kiko Beats](http://www.kikobeats.com)

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