diff options
author | Caolan McMahon <caolan@caolanmcmahon.com> | 2013-03-03 11:25:18 +0000 |
---|---|---|
committer | Caolan McMahon <caolan@caolanmcmahon.com> | 2013-03-03 11:25:18 +0000 |
commit | f4dbaf601b1fc6f9436d200ef716dc5a47870423 (patch) | |
tree | 256ad2d81f9e108a116165ab39af85afbd1a8f1b /README.md | |
parent | d321d633d10f2b04d25edd702f9db7614a9cff59 (diff) | |
download | async-f4dbaf601b1fc6f9436d200ef716dc5a47870423.tar.gz |
add applyEach function
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -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) @@ -833,6 +834,36 @@ add1mul3(4, function (err, result) { ``` --------------------------------------- +<a name="applyEach" /> +### 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 +); +``` + +--------------------------------------- <a name="queue" /> ### queue(worker, concurrency) |