# async-each-map

> Dependency free async each, map, and reduce written in ES6 package for Node.js

Latest version **1.0.2** (published 2016-05-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install async-each-map
pnpm add async-each-map
yarn add async-each-map
bun add async-each-map
```

## 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.0.2 |
| Published | 2016-05-31 |
| First published | 2016-01-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Hans Kristian Flaatten |
| Maintainers | starefossen |
| Keywords | ES6, async, array, each, map, reduce |

## Links

- npm: https://www.npmjs.com/package/async-each-map
- Repository: https://github.com/Starefossen/node-async-each-map
- Homepage: https://github.com/Starefossen/node-async-each-map#readme
- Issues: https://github.com/Starefossen/node-async-each-map/issues
- npm.io page: https://npm.io/package/async-each-map

## 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.0.2 (latest) — 2016-05-31
- 1.0.1 — 2016-01-25
- 1.0.0 — 2016-01-25

## README

# Async; Each, Map, Reduce

[![Build status](https://img.shields.io/wercker/ci/56a5c21f090a9b0d1d03e152.svg "Build status")](https://app.wercker.com/project/bykey/ea2f7fef7cf5cc63c7c4c50405a77b4d)
[![Codacy](https://img.shields.io/codacy/63ff3a4fec73469d9be8e2ffdb489c7f.svg "Codacy")](https://www.codacy.com/app/starefossen/node-node-async-each-map)
[![NPM downloads](https://img.shields.io/npm/dm/async-each-map.svg "NPM downloads")](https://www.npmjs.com/package/async-each-map)
[![NPM version](https://img.shields.io/npm/v/async-each-map.svg "NPM version")](https://www.npmjs.com/package/async-each-map)
[![Node version](https://img.shields.io/node/v/async-each-map.svg "Node version")](https://www.npmjs.com/package/async-each-map)
[![Dependency status](https://img.shields.io/david/Starefossen/node-async-each-map.svg "Dependency status")](https://david-dm.org/Starefossen/node-async-each-map)

Efficient, light wegith, dependency free NPM package for doing asyncronous each,
map, and reduce operations in Node.js.

## Requirements

* Node.JS >= v4.0.0

## Install

```
$ npm install async-each-map --save
```

## Usage

```js
const each = require('async-each-map');
```

### each(array, iterator, [callback])

Applies the `iterator` function to each item in `array`, in sequence and in
order.  The `iterator` is called with an item from the list, and a `next`
function for when it has finished. If the `iterator` passes an error to the
`next` function, the `callback` is immediately called with the error.

#### Arguments

* `array` - An array to iterate over.
* `iterator(item, next)` - A function to apply to each item in arr. The iterator
  is passed a callback(err) which must be called once it has completed. If no
  error has occurred, the callback should be run without arguments or with an
  explicit null argument. The array index is not passed to the iterator.
* `callback(error, array)` - *Optional* A callback which is called when all
  iterator functions have finished, or an error occurs. When using the map
  functionality a second parameter is provided.

#### Examples

```js
each([3, 6, 2, 9], (item, next) => {
  some.async.operation(item, error => {
    next(error);
  });
}, error => {
  if (error) { throw error; }

  console.log('Done!');
});
```

### Map

```js
each(['/some/file1', '/some/file2', '/some/file3'], fs.readFile, (error, files) => {
  if (error) { throw error; }

  for (const content in files) {
    console.log(content);
  }
})
```

### Reduce

```js
each(['/some/file1', '/some/file2', '/some/file3'], fs.exists, (error, files) => {
  if (error) { throw error; }

  for (const file in files) {
    console.log(`${file} exists`);
  }
});
```

## [MIT Licensed](https://github.com/Starefossen/node-async-each-map/blob/master/LICENSE)

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