A simple API for running async functions in parallel.
$ component install ianstormtaylor/parallel
$ npm install ianstormtaylor/parallel
var parallel = require('parallel');
function getOwner (id, callback) {
parallel()
.add(users.get)
.add(organizations.get)
.end(id, function (err, results) {
if (err) return callback(err);
callback(results[0] || results[1]);
});
}Add a fn to be called in parallel. Optionally add args... specific to the function. Aliased to push in case you forget you aren't using batch.
Pass a context for all of the functions to be bound with.
Run the functions in parallel and callback. Optionally pass in args... to be passed to all the functions.
MIT