# paramap-it

> Parallel mapping for async iterators

Latest version **0.1.1** (published 2019-03-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install paramap-it
pnpm add paramap-it
yarn add paramap-it
bun add paramap-it
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2019-03-04 |
| First published | 2019-03-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alan Shaw |
| Maintainers | alanshaw |
| Keywords | map, parallel, concurrent, iterator, async |

## Links

- npm: https://www.npmjs.com/package/paramap-it
- Repository: https://github.com/alanshaw/paramap-it
- Homepage: https://github.com/alanshaw/paramap-it#readme
- Issues: https://github.com/alanshaw/paramap-it/issues
- npm.io page: https://npm.io/package/paramap-it

## Dependencies (1)

- [event-iterator](https://npm.io/package/event-iterator.md) ^1.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

- 0.1.1 (latest) — 2019-03-04
- 0.1.0 — 2019-03-04

## README

# paramap-it

[![Build Status](https://travis-ci.org/alanshaw/paramap-it.svg?branch=master)](https://travis-ci.org/alanshaw/paramap-it)
[![dependencies Status](https://david-dm.org/alanshaw/paramap-it/status.svg)](https://david-dm.org/alanshaw/paramap-it)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

> Parallel mapping for async iterators

You have an async transform you need to apply to the values you get from an iterable, but want to apply these transforms in parallel and retain the original ordering.

## Install

```sh
npm i paramap-it
```

## Usage

```js
const paramap = require('paramap-it')
const pause = ms => new Promise(resolve => setTimeout(resolve, ms))

const source = [1, 2, 3, 4, 5] // Can be ANY iterable or async iterable

// Asynchronously double the values from the source iterable IN PARALLEL
const doubler = paramap(source, async value => {
  await pause(Math.random())
  return value * 2
})

for await (const value of doubler) {
  console.log(value)
}

// Logs:
// 2
// 4
// 6
// 8
// 10
// Note: order is retained
```

## API

```js
const paramap = require('paramap-it')
```

### `paramap(source, mapper, [options])`

Returns a new async iterable that can be used to consume the `source` iterable, applying the async `mapper` function to each item.

* `source` (`async Iterable`) - `Iterable` or `AsyncIterable` to map data from
* `mapper` (`async Function`) - Function that receives one parameter, the value to be mapped, and should return a `Promise` that resolves to the mapped value
* `options.ordered` (`Boolean` default `true`) - set to `false` to discard ordering and yield values as soon as they are resolved (more performant)

## Contribute

Feel free to dive in! [Open an issue](https://github.com/alanshaw/paramap-it/issues/new) or submit PRs.

## License

[MIT](https://github.com/alanshaw/paramap-it/blob/master/LICENSE) © Alan Shaw

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