# async-promise-wrapper

> Leverage the caolan/async library to coordinate promise control flow.

Latest version **1.1.1** (published 2019-04-14) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install async-promise-wrapper
pnpm add async-promise-wrapper
yarn add async-promise-wrapper
bun add async-promise-wrapper
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2019-04-14 |
| First published | 2018-05-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 14.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jim Baldwin |
| Maintainers | jmbldwn |
| Keywords | async, promise |

## Links

- npm: https://www.npmjs.com/package/async-promise-wrapper
- Repository: https://github.com/Antimatter/async-promise-wrapper
- Homepage: https://github.com/Antimatter/async-promise-wrapper#readme
- Issues: https://github.com/Antimatter/async-promise-wrapper/issues
- npm.io page: https://npm.io/package/async-promise-wrapper

## Dependencies (1)

- [async](https://npm.io/package/async.md) ^2.6.2

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@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

## Recent versions

- 1.1.1 (latest) — 2019-04-14
- 1.1.0 — 2018-08-02
- 1.0.2 — 2018-08-02
- 1.0.1 — 2018-05-15
- 1.0.0 — 2018-05-13

## README

# async-promise-wrapper
[![CircleCI](https://circleci.com/gh/Antimatter/async-promise-wrapper/tree/master.svg?style=svg)](https://circleci.com/gh/Antimatter/async-promise-wrapper/tree/master)
## Async libraries wrapped to use promises

Maps most of the functions in caolan/async to work with functions that return promises instead of iteratees and callbacks.  Iplemented as a simple wrapper that works for most of those methods with very little code.

Here's an example:

if you implemented a callback-based control flow with caolan/async like this:

```
const async = require('async');
async.mapLimit(collection, 2, (item, callback) => {
    callback(null, someKindOfTransform(item));
})
```

With this library you can do your transform as a promise-returning function instead

```
const ap = require('async-promise-wrapper');
ap.mapLimit(collection, 2, item => {
    return functionThatReturnsPromise(item);
});
```

Each of the following caolan/async functions has been mapped to work this way:

```
concat
concatSeries
detect
detectSeries
each
eachSeries
eachOf
eachOfSeries
every
everySeries
filter
filterSeries
map
mapSeries
mapValues
mapValuesSeries
reject
rejectSeries
some
someSeries
sortBy
detectLimit
eachLimit
eachOfLimit
everyLimit
filterLimit
mapLimit
mapValuesLimit
rejectLimit
someLimit
doWhilst
whilst
retry
```
I've added a couple of handy functions as well:
```
retryForever(interval, pf)
delay(timeout, pf)
```

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