From 028e1e6553d6fb2dbdddee2845d1d9f49722a4da Mon Sep 17 00:00:00 2001 From: Alexander Early Date: Sat, 22 Jun 2019 18:41:58 -0700 Subject: [PATCH] fix(docs): applyEach docs. Closes #1658 --- docs/v3/applyEach.js.html | 13 +++++++------ docs/v3/applyEachSeries.js.html | 6 +++--- docs/v3/docs.html | 27 ++++++++++++++------------- docs/v3/module-ControlFlow.html | 27 ++++++++++++++------------- lib/applyEach.js | 13 +++++++------ lib/applyEachSeries.js | 6 +++--- 6 files changed, 48 insertions(+), 44 deletions(-) diff --git a/docs/v3/applyEach.js.html b/docs/v3/applyEach.js.html index be2a3e5a6..15dbe2248 100644 --- a/docs/v3/applyEach.js.html +++ b/docs/v3/applyEach.js.html @@ -98,13 +98,14 @@

applyEach.js

* 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, `fns`, is provided, it will - * return a function which lets you pass in the arguments as if it were a single - * function call. The signature is `(..args, callback)`. If invoked with any - * arguments, `callback` is required. + * @returns {AsyncFunction} - Returns a function that takes no args other than + * an optional callback, that is the result of applying the `args` to each + * of the functions. * @example * - * async.applyEach([enableSearch, updateSchema], 'bucket', (err, results) => { + * const appliedFn = async.applyEach([enableSearch, updateSchema], 'bucket') + * + * appliedFn((err, results) => { * // results[0] is the results for `enableSearch` * // results[1] is the results for `updateSchema` * }); @@ -112,7 +113,7 @@

applyEach.js

* // partial application example: * async.each( * buckets, - * async.applyEach([enableSearch, updateSchema]), + * async (bucket) => async.applyEach([enableSearch, updateSchema], bucket)(), * callback * ); */ diff --git a/docs/v3/applyEachSeries.js.html b/docs/v3/applyEachSeries.js.html index bb1410737..d946090cf 100644 --- a/docs/v3/applyEachSeries.js.html +++ b/docs/v3/applyEachSeries.js.html @@ -93,9 +93,9 @@

applyEachSeries.js

* 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. + * @returns {AsyncFunction} - A function, that when called, is the result of + * appling the `args` to the list of functions. It takes no args, other than + * a callback. */ export default applyEach(mapSeries); diff --git a/docs/v3/docs.html b/docs/v3/docs.html index 412eab337..8b1104942 100644 --- a/docs/v3/docs.html +++ b/docs/v3/docs.html @@ -9243,7 +9243,7 @@

Methods

-

(static) applyEach(fns, …argsopt, callbackopt) → {function}

+

(static) applyEach(fns, …argsopt, callbackopt) → {AsyncFunction}

@@ -9386,10 +9386,9 @@
Returns:
@@ -9401,7 +9400,7 @@
Returns:
-function +AsyncFunction
@@ -9412,7 +9411,9 @@
Returns:
Example
-
async.applyEach([enableSearch, updateSchema], 'bucket', (err, results) => {
+    
const appliedFn = async.applyEach([enableSearch, updateSchema], 'bucket')
+
+appliedFn((err, results) => {
     // results[0] is the results for `enableSearch`
     // results[1] is the results for `updateSchema`
 });
@@ -9420,7 +9421,7 @@ 
Example
// partial application example: async.each( buckets, - async.applyEach([enableSearch, updateSchema]), + async (bucket) => async.applyEach([enableSearch, updateSchema], bucket)(), callback );
@@ -9485,7 +9486,7 @@
Example
-

(static) applyEachSeries(fns, …argsopt, callbackopt) → {function}

+

(static) applyEachSeries(fns, …argsopt, callbackopt) → {AsyncFunction}

@@ -9622,9 +9623,9 @@
Returns:
    -
  • 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.
  • +
  • A function, that when called, is the result of +appling the args to the list of functions. It takes no args, other than +a callback.
@@ -9636,7 +9637,7 @@
Returns:
-function +AsyncFunction
diff --git a/docs/v3/module-ControlFlow.html b/docs/v3/module-ControlFlow.html index 70273464f..ed1ff8e2a 100644 --- a/docs/v3/module-ControlFlow.html +++ b/docs/v3/module-ControlFlow.html @@ -188,7 +188,7 @@

Methods

-

(static) applyEach(fns, …argsopt, callbackopt) → {function}

+

(static) applyEach(fns, …argsopt, callbackopt) → {AsyncFunction}

@@ -331,10 +331,9 @@
Returns:
    -
  • If only the first argument, fns, is provided, it will -return a function which lets you pass in the arguments as if it were a single -function call. The signature is (..args, callback). If invoked with any -arguments, callback is required.
  • +
  • Returns a function that takes no args other than +an optional callback, that is the result of applying the args to each +of the functions.
@@ -346,7 +345,7 @@
Returns:
-function +AsyncFunction
@@ -357,7 +356,9 @@
Returns:
Example
-
async.applyEach([enableSearch, updateSchema], 'bucket', (err, results) => {
+    
const appliedFn = async.applyEach([enableSearch, updateSchema], 'bucket')
+
+appliedFn((err, results) => {
     // results[0] is the results for `enableSearch`
     // results[1] is the results for `updateSchema`
 });
@@ -365,7 +366,7 @@ 
Example
// partial application example: async.each( buckets, - async.applyEach([enableSearch, updateSchema]), + async (bucket) => async.applyEach([enableSearch, updateSchema], bucket)(), callback );
@@ -430,7 +431,7 @@
Example
-

(static) applyEachSeries(fns, …argsopt, callbackopt) → {function}

+

(static) applyEachSeries(fns, …argsopt, callbackopt) → {AsyncFunction}

@@ -567,9 +568,9 @@
Returns:
    -
  • 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.
  • +
  • A function, that when called, is the result of +appling the args to the list of functions. It takes no args, other than +a callback.
@@ -581,7 +582,7 @@
Returns:
-function +AsyncFunction
diff --git a/lib/applyEach.js b/lib/applyEach.js index 45462619f..b7f880f45 100644 --- a/lib/applyEach.js +++ b/lib/applyEach.js @@ -21,13 +21,14 @@ import map from './map'; * 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, `fns`, is provided, it will - * return a function which lets you pass in the arguments as if it were a single - * function call. The signature is `(..args, callback)`. If invoked with any - * arguments, `callback` is required. + * @returns {AsyncFunction} - Returns a function that takes no args other than + * an optional callback, that is the result of applying the `args` to each + * of the functions. * @example * - * async.applyEach([enableSearch, updateSchema], 'bucket', (err, results) => { + * const appliedFn = async.applyEach([enableSearch, updateSchema], 'bucket') + * + * appliedFn((err, results) => { * // results[0] is the results for `enableSearch` * // results[1] is the results for `updateSchema` * }); @@ -35,7 +36,7 @@ import map from './map'; * // partial application example: * async.each( * buckets, - * async.applyEach([enableSearch, updateSchema]), + * async (bucket) => async.applyEach([enableSearch, updateSchema], bucket)(), * callback * ); */ diff --git a/lib/applyEachSeries.js b/lib/applyEachSeries.js index 6a4d62b6c..ae2661603 100644 --- a/lib/applyEachSeries.js +++ b/lib/applyEachSeries.js @@ -16,8 +16,8 @@ import mapSeries from './mapSeries'; * 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. + * @returns {AsyncFunction} - A function, that when called, is the result of + * appling the `args` to the list of functions. It takes no args, other than + * a callback. */ export default applyEach(mapSeries);