Asynchronous Array Map
An alternative interface to batch inspired by the awesome async library.
$ component install timoxley/async-map
todo
var map = require('async-map') map([1, 2], function(item, next) { next(null, item) }, function(err, results) { assert.ifError(err) assert.deepEqual(results, [1, 2]) done() })
todo
map(array, task, complete)
Calls
task
for each item inarray
, then callscomplete
when done.
Tasks are functions whose first param will be the current item, the second a callback:
function(item, next) {
}
The callback takes two parameters, an error (if any) and an item
function(item, next) { next(err, item) }
MIT