# async-await-all

> await for all

Latest version **1.2.0** (published 2017-11-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install async-await-all
pnpm add async-await-all
yarn add async-await-all
bun add async-await-all
```

## 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.2.0 |
| Published | 2017-11-25 |
| First published | 2017-11-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | AndyP |
| Maintainers | andy*() |
| Keywords | await, async, all |

## Links

- npm: https://www.npmjs.com/package/async-await-all
- Repository: https://github.com/andy2046/async-await-all
- Homepage: https://github.com/andy2046/async-await-all#readme
- Issues: https://github.com/andy2046/async-await-all/issues
- npm.io page: https://npm.io/package/async-await-all

## Dependencies (1)

- [fibers](https://npm.io/package/fibers.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.2.0 (latest) — 2017-11-25
- 1.1.0 — 2017-11-03
- 1.0.0 — 2017-11-02

## README

# async-await-all
async-await-all is a JavaScript library for **asyncMe**, **awaitMe**, **await$**

```js
asyncMe = async

awaitMe = await

await$  = await Promise.all(promiseArray)
```

## Examples
```js
const { asyncMe, awaitMe, await$ } = require('async-await-all')

const sleep = ms => {
  return new Promise(resolve => {
    setTimeout(() => resolve(ms), ms)
  })
}

const awaitMeExample = asyncMe(function(ms) {
  try {
    console.log('1...', new Date)
    const ret = awaitMe(sleep(ms))
    console.log('2...', new Date)
    return ret
  } catch (e) {
    console.log(e)
  }
})

const awaitAllExample = asyncMe(function(ms) {
  try {
    console.log('3...', new Date)
    const ret = await$([sleep(ms), sleep(ms*2)])
    console.log('4...', new Date)
    return ret
  } catch (e) {
    console.log(e)
  }
})

awaitMeExample(1000)
  .then(console.log)
  .catch(console.error)
  .then(() => {
    awaitAllExample(1000)
      .then(console.log)
      .catch(console.error)
  })

/*

1... 2017-11-02T07:49:13.636Z
2... 2017-11-02T07:49:14.643Z
1000
3... 2017-11-02T07:49:14.644Z
4... 2017-11-02T07:49:16.649Z
[ 1000, 2000 ]

*/


```

## Installation

```
npm install --save async-await-all
```

## Usage
You can import from `async-await-all`:

```js
import { asyncMe, awaitMe, await$ } from 'async-await-all'
// or
const { asyncMe, awaitMe, await$ } = require('async-await-all')

// if you see any issue with node-fibers e.g. There is an issue with `node-fibers`
// please refer to https://github.com/laverdet/node-fibers#supported-platforms
```

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