Asynchronously iterate an array as a series in Node.js
OTHER License
Asynchronously iterate an array as a series. Similar to async.eachSeries, but as a small module.
Install through npm
npm install each-series
var each = require('each-series');
each([1,2,3,4,5,6,7], function(el, i, done) {
setTimeout(function() {
console.log(el);
done();
}, 100 - (el * 10));
}, function(err) {
console.log('Done!');
});
The module is only one function
each(array, iterator, [callback])
The callback is optional.
If an error is passed to the done
function passed to the iterator, iteration will be stopped and the callback
will be invoked with the error.
MIT License