# tiny-each-async

> Asynchronous iterator function for parallel processing.

Latest version **2.0.3** (published 2016-04-05) · MIT license · 0 weekly downloads

## Install

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

## 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 | 2.0.3 |
| Published | 2016-04-05 |
| First published | 2015-10-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Alexandru Vladutu |
| Maintainers | alessioalex |
| Keywords | each, async, asynchronous, iteration, iterate, loop, foreach, parallel, concurrent, array, flow, control flow |

## Links

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

## 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

- 2.0.3 (latest) — 2016-04-05
- 2.0.2 — 2015-11-09
- 2.0.1 — 2015-11-06
- 2.0.0 — 2015-11-06
- 1.1.0 — 2015-10-26
- 1.0.0 — 2015-10-26

## README

# tiny-each-async

Asynchronous iterator function similar to (and inspired by) [async.each](https://github.com/caolan/async#eacharr-iterator-callback), with support for concurrency limit and item index.

[![build status](https://secure.travis-ci.org/alessioalex/tiny-each-async.png)](http://travis-ci.org/alessioalex/tiny-each-async)

## Usage

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

Arguments:

- array - An array of items to iterate through.
- [limit] - An (optional) integer for determining how many `iterator` functions should be run in parallel.
- iterator(item, [index], callback) - A function to be applied to each item in the array. When it has finished processing the item then the `callback` function should be called (in case of a failure with the `error` argument, otherwise none).
- callback(err) - An optional callback function that gets called when either all `iterator` functions have finished or one of them has returned an error.

### Example

```js
var eachAsync = require('tiny-each-async');
var timeouts = [300, 100, 2000];

eachAsync(['file1', 'file2', 'file3'], function(item, index, next) {
  setTimeout(function() {
    console.log(item, index, timeouts[index]);
    next();
  }, timeouts[index]);
}, function(err) {
  return err ? console.error(err.stack) : console.log('all done');
});
```

For more examples checkout the [/examples](/examples) folder.

## FAQ

- Why the name?

Other possible names were already taken, and the actual source code is tiny.

- Why create another async library?

Because doing your own thing is fun.

- What if my iterator function is sync, but I want it && the callback to be async?

Then you might want to use [dezalgo](https://github.com/npm/dezalgo).

## License

[MIT](http://alessioalex.mit-license.org/)

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