From f4dbaf601b1fc6f9436d200ef716dc5a47870423 Mon Sep 17 00:00:00 2001 From: Caolan McMahon Date: Sun, 3 Mar 2013 11:25:18 +0000 Subject: add applyEach function --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 2535cf8..9927c98 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ So far its been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage: * [doUntil](#doUntil) * [waterfall](#waterfall) * [compose](#compose) +* [applyEach](#applyEach) * [queue](#queue) * [cargo](#cargo) * [auto](#auto) @@ -832,6 +833,36 @@ add1mul3(4, function (err, result) { }); ``` +--------------------------------------- + +### applyEach(fns, args..., callback) + +Applies the provided arguments to each function in the array, calling the +callback after all functions have completed. If you only provide the first +argument then it will return a function which lets you pass in the +arguments as if it were a single function call. + +__Arguments__ + +* fns - the asynchronous functions to all call with the same arguments +* args... - any number of separate arguments to pass to the function +* callback - the final argument should be the callback, called when all + functions have completed processing + + +__Example__ + +```js +async.applyEach([enableSearch, updateSchema], 'bucket', callback); + +// partial application example: +async.each( + buckets, + async.applyEach([enableSearch, updateSchema]), + callback +); +``` + --------------------------------------- -- cgit v1.2.1