summaryrefslogtreecommitdiff
path: root/lib/applyEach.js
diff options
context:
space:
mode:
authorHubert Argasinski <argasinski.hubert@gmail.com>2016-03-31 02:22:16 -0700
committerGraeme Yeates <yeatesgraeme@gmail.com>2016-04-12 18:46:28 -0400
commit8eb2a7cec2c62edf35d7b812765bd64e6b7d484f (patch)
tree76a0c7715c612acddd9e6801dc14ec43f768176f /lib/applyEach.js
parenta778ee63788d533111ff63b611cc5034e18a907f (diff)
downloadasync-8eb2a7cec2c62edf35d7b812765bd64e6b7d484f.tar.gz
jsdoc-style documentation began documenting `Control Flow` methods
remaining `Control Flow` methods to document: - queue - priorityQueue - cargo - auto - autoInject - retry - retryable - iterator - times, timesSeries, timesLimit - race
Diffstat (limited to 'lib/applyEach.js')
-rw-r--r--lib/applyEach.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/applyEach.js b/lib/applyEach.js
index 73a89d2..d807e04 100644
--- a/lib/applyEach.js
+++ b/lib/applyEach.js
@@ -3,4 +3,34 @@
import applyEach from './internal/applyEach';
import map from './map';
+/**
+ * Applies the provided arguments to each function in the array, calling
+ * `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.
+ *
+ * @name applyEach
+ * @static
+ * @memberOf async
+ * @category Control Flow
+ * @param {Array|Object} fns - A collection of asynchronous functions to all
+ * call with the same arguments
+ * @param {...*} [args] - any number of separate arguments to pass to the
+ * function.
+ * @param {Function} [callback] - the final argument should be the callback,
+ * called when all functions have completed processing.
+ * @returns {Function} - If only the first argument is provided, it will return
+ * a function which lets you pass in the arguments as if it were a single
+ * function call.
+ * @example
+ *
+ * async.applyEach([enableSearch, updateSchema], 'bucket', callback);
+ *
+ * // partial application example:
+ * async.each(
+ * buckets,
+ * async.applyEach([enableSearch, updateSchema]),
+ * callback
+ * );
+ */
export default applyEach(map);