# @xen-orchestra/async-map

> Promise.all + map for all iterables

Latest version **0.1.4** (published 2026-08-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install @xen-orchestra/async-map
pnpm add @xen-orchestra/async-map
yarn add @xen-orchestra/async-map
bun add @xen-orchestra/async-map
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

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

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2026-08-25 |
| First published | 2018-09-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 1 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 988 |
| Author | Vates SAS |
| Maintainers | mlssfrncjrg, mathieura, florent.beauchamp, julien-f, marsaud, pdonias, benjireis, tgoettelmann, b-nollet, joris-k, elise-f, olivier.f, pierre.brunet289 |
| Keywords | array, async, iterable, map, settled, typescript |

## Links

- npm: https://www.npmjs.com/package/@xen-orchestra/async-map
- Repository: https://github.com/vatesfr/xen-orchestra
- Homepage: https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/async-map
- Issues: https://github.com/vatesfr/xen-orchestra/issues
- npm.io page: https://npm.io/package/@xen-orchestra/async-map

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.18.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.1.4 (latest) — 2026-08-25
- 0.1.3 — 2026-04-24
- 0.1.2 — 2021-03-03
- 0.1.1 — 2021-03-03
- 0.1.0 — 2021-03-03
- 0.0.0 — 2018-09-21

## README

<!-- DO NOT EDIT MANUALLY, THIS FILE HAS BEEN GENERATED -->

# @xen-orchestra/async-map

[![Package Version](https://badgen.net/npm/v/@xen-orchestra/async-map)](https://npmjs.org/package/@xen-orchestra/async-map) ![License](https://badgen.net/npm/license/@xen-orchestra/async-map) [![PackagePhobia](https://badgen.net/bundlephobia/minzip/@xen-orchestra/async-map)](https://bundlephobia.com/result?p=@xen-orchestra/async-map) [![Node compatibility](https://badgen.net/npm/node/@xen-orchestra/async-map)](https://npmjs.org/package/@xen-orchestra/async-map)

> Promise.all + map for all iterables

## Install

Installation of the [npm package](https://npmjs.org/package/@xen-orchestra/async-map):

```sh
npm install --save @xen-orchestra/async-map
```

## Usage

### `asyncMap(iterable, iteratee, thisArg = iterable)`

Similar to `Promise.all + Array#map` for all iterables: calls `iteratee` for each item in `iterable`, and returns a promise of an array containing the awaited result of each calls to `iteratee`.

It rejects as soon as te first call to `iteratee` rejects.

```js
import { asyncMap } from '@xen-orchestra/async-map'

const array = await asyncMap(iterable, iteratee, thisArg)
```

It can be used with any iterables (`Array`, `Map`, etc.):

```js
const map = new Map()
map.set('foo', 42)
map.set('bar', 3.14)

const array = await asyncMap(map, async function ([key, value]) {
  // TODO: do async computation
  //
  // the map can be accessed via `this`
})
```

#### Use with plain objects

Plain objects are not iterable, but you can use `Object.keys`, `Object.values` or `Object.entries` to help:

```js
const object = {
  foo: 42,
  bar: 3.14,
}

const array = await asyncMap(
  Object.entries(object),
  async function ([key, value]) {
    // TODO: do async computation
    //
    // the object can be accessed via `this` because it's been passed as third arg
  },
  object
)
```

### `asyncMapSettled(iterable, iteratee, thisArg = iterable)`

Similar to `asyncMap` but waits for all promises to settle before rejecting.

```js
import { asyncMapSettled } from '@xen-orchestra/async-map'

const array = await asyncMapSettled(iterable, iteratee, thisArg)
```

## Contributions

Contributions are _very_ welcomed, either on the documentation or on
the code.

You may:

- report any [issue](https://github.com/vatesfr/xen-orchestra/issues)
  you've encountered;
- fork and create a pull request.

## License

[ISC](https://spdx.org/licenses/ISC) © [Vates SAS](https://vates.fr)

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