# ee-async

> simpler control flow for asynchronous operations

Latest version **0.3.1** (published 2014-09-03) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install ee-async
pnpm add ee-async
yarn add ee-async
bun add ee-async
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2014-09-03 |
| First published | 2013-11-08 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=v0.10.17 |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Michael van der Weg |
| Maintainers | ee, rcky |
| Keywords | asnc, control-flow, each, chain, wait |

## Links

- npm: https://www.npmjs.com/package/ee-async
- Repository: https://github.com/eventEmitter/ee-async
- Issues: https://github.com/eventEmitter/ee-async/issues
- npm.io page: https://npm.io/package/ee-async

## Dependencies (4)

- [ee-log](https://npm.io/package/ee-log.md) 0.2.x
- [ee-class](https://npm.io/package/ee-class.md) 1.0.x
- [ee-error](https://npm.io/package/ee-error.md) 0.1.x
- [ee-types](https://npm.io/package/ee-types.md) 0.1.x

## 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.3.1 (latest) — 2014-09-03
- 0.3.0 — 2014-08-28
- 0.2.11 — 2014-08-23
- 0.2.10 — 2014-06-16
- 0.2.9 — 2014-05-20
- 0.2.8 — 2014-05-20
- 0.2.7 — 2014-05-16
- 0.2.6 — 2014-05-16
- 0.2.5 — 2014-05-08
- 0.2.4 — 2014-04-18
- 0.2.3 — 2014-04-18
- 0.2.2 — 2014-03-25
- 0.2.1 — 2014-03-25
- 0.2.0 — 2014-03-21
- 0.1.0 — 2013-11-08

## README

# ee-async

simple control flow helpers

## installation

	npm install ee-async

## build status

[![Build Status](https://travis-ci.org/eventEmitter/ee-async.png?branch=master)](https://travis-ci.org/eventEmitter/ee-async)


## usage

	var async = require( "ee-async" );

### each

execute a function on every item passed to the function using an array

	async.each( [ items ], worker, [ worker ], [ .. ], callback );

the array of items can also be an array of array if the workers need more than one argument applied to them	

	async.each( [ "1.txt", "2.txt" ]
		, fs.readFile
		, function( data, next ){ 
			next( null, data.toString() ); 
		}
		, function( err, results ){
			log( results ); // [ "contents of 1.txt", "contents of 2.txt" ]
		} 
	);

### wait

execute functions in parallel

	async.wait( function( complete ){ 
			complete( 1 ); 
		}, function( complete ){ 
			complete( 2 ); 
		}, function( err, results ){
			log( results ); // [ 1, 2 ]
		} 
	);


## chain

pass input through a chain of functions
	

	async.chain("./test/1.txt"
		, fs.readFile
		, function( data, next ){ 
			next( null, data.toString() ); 
		}
		, function( err, data ){
			log( data ); // "contents of 1.txt"
		} 
	);


wait for several callbacks


	var waiter = async.waiter(function(err) {
		// both load events were fired
	});

	someAsyncApi.on('load', waiter());
	anotherApi.on('load', waiter());

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