Package Exports
- each-async
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (each-async) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
each-async 
Async parallel iterator
Like async.each, but smaller.
Install
Download manually or with a package-manager.
npm
npm install --save each-async
Bower
bower install --save each-async
Component
component install sindresorhus/each-async
Examples
Node.js
var eachAsync = require('each-async');
eachAsync(['foo','bar','baz'], function (item, index, done) {
console.log(item, index);
done();
}, function (error) {
console.log('finished');
});
//=> foo 0
//=> bar 1
//=> baz 2
//=> finished
Bower
<script src="bower_components/each-async/each-async.js"></script>
eachAsync(['foo','bar','baz'], function (item, index, done) {
console.log(item, index);
done();
}, function (error) {
console.log('finished');
});
//=> foo 0
//=> bar 1
//=> baz 2
//=> finished
API
eachAsync(array, callback, finishedCallback)
array
The array you want to iterate.
callback(item, index, done)
A function which is called for each item in the array with the following arguments:
item
: the current item in the arrayindex
: the current indexdone([error])
: call this when you're done with an optional error. Supplying anything other thanundefined
/null
will stop the iteration.
Note that order is not guaranteed since each item is handled in parallel.
finishedCallback(error)
A function which is called when the iteration is finished or on the first error. First argument is the error passed from done()
in the callback
.
License
MIT © Sindre Sorhus