Skip to content

Commit

Permalink
use the AsyncFunction type in all docs 😓
Browse files Browse the repository at this point in the history
  • Loading branch information
aearly committed Apr 1, 2017
1 parent faf395c commit 94a8b2d
Show file tree
Hide file tree
Showing 66 changed files with 237 additions and 248 deletions.
2 changes: 1 addition & 1 deletion lib/applyEach.js
Expand Up @@ -13,7 +13,7 @@ import map from './map';
* @memberOf module:ControlFlow
* @method
* @category Control Flow
* @param {Array|Iterable|Object} fns - A collection of asynchronous functions
* @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s
* to all call with the same arguments
* @param {...*} [args] - any number of separate arguments to pass to the
* function.
Expand Down
2 changes: 1 addition & 1 deletion lib/applyEachSeries.js
Expand Up @@ -10,7 +10,7 @@ import mapSeries from './mapSeries';
* @method
* @see [async.applyEach]{@link module:ControlFlow.applyEach}
* @category Control Flow
* @param {Array|Iterable|Object} fns - A collection of asynchronous functions to all
* @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s to all
* call with the same arguments
* @param {...*} [args] - any number of separate arguments to pass to the
* function.
Expand Down
8 changes: 4 additions & 4 deletions lib/asyncify.js
Expand Up @@ -20,10 +20,10 @@ import initialParams from './internal/initialParams';
* @method
* @alias wrapSync
* @category Util
* @param {Function} func - The synchronous function to convert to an
* asynchronous function.
* @returns {Function} An asynchronous wrapper of the `func`. To be invoked with
* (callback).
* @param {Function} func - The synchronous funuction, or Promise-returning
* function to convert to an {@link AsyncFunction}.
* @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be

This comment has been minimized.

Copy link
@megawac

megawac Apr 2, 2017

Collaborator

do you if to @link this one?

This comment has been minimized.

Copy link
@aearly

aearly Apr 2, 2017

Author Collaborator

No, it works just like the @param types.

This comment has been minimized.

Copy link
@megawac

megawac Apr 2, 2017

Collaborator

thanks

* invoked with `(args..., callback)`.
* @example
*
* // passing a regular synchronous function
Expand Down
8 changes: 4 additions & 4 deletions lib/auto.js
Expand Up @@ -11,17 +11,17 @@ import onlyOnce from './internal/onlyOnce';
import wrapAsync from './internal/wrapAsync';

/**
* Determines the best order for running the functions in `tasks`, based on
* Determines the best order for running the {@link AsyncFunction}s in `tasks`, based on
* their requirements. Each function can optionally depend on other functions
* being completed first, and each function is run as soon as its requirements
* are satisfied.
*
* If any of the functions pass an error to their callback, the `auto` sequence
* If any of the {@link AsyncFunction}s pass an error to their callback, the `auto` sequence
* will stop. Further tasks will not execute (so any other functions depending
* on it will not run), and the main `callback` is immediately called with the
* error.
*
* Functions also receive an object containing the results of functions which
* {@link AsyncFunction}s also receive an object containing the results of functions which
* have completed so far as the first argument, if they have dependencies. If a
* task function has no dependencies, it will only be passed a callback.
*
Expand All @@ -31,7 +31,7 @@ import wrapAsync from './internal/wrapAsync';
* @method
* @category Control Flow
* @param {Object} tasks - An object. Each of its properties is either a
* function or an array of requirements, with the function itself the last item
* function or an array of requirements, with the {@link AsyncFunction} itself the last item
* in the array. The object's key of a property serves as the name of the task
* defined by that property, i.e. can be used when specifying requirements for
* other tasks. The function receives one or two arguments:
Expand Down
2 changes: 1 addition & 1 deletion lib/autoInject.js
Expand Up @@ -40,7 +40,7 @@ function parseParams(func) {
* @method
* @see [async.auto]{@link module:ControlFlow.auto}
* @category Control Flow
* @param {Object} tasks - An object, each of whose properties is a function of
* @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of
* the form 'func([dependencies...], callback). The object's key of a property
* serves as the name of the task defined by that property, i.e. can be used
* when specifying requirements for other tasks.
Expand Down
5 changes: 2 additions & 3 deletions lib/cargo.js
Expand Up @@ -48,9 +48,8 @@ import queue from './internal/queue';
* @method
* @see [async.queue]{@link module:ControlFlow.queue}
* @category Control Flow
* @param {Function} worker - An asynchronous function for processing an array
* of queued tasks, which must call its `callback(err)` argument when finished,
* with an optional `err` argument. Invoked with `(tasks, callback)`.
* @param {AsyncFunction} worker - An asynchronous function for processing an array
* of queued tasks. Invoked with `(tasks, callback)`.
* @param {number} [payload=Infinity] - An optional `integer` for determining
* how many tasks should be processed per round; if omitted, the default is
* unlimited.
Expand Down
2 changes: 1 addition & 1 deletion lib/compose.js
Expand Up @@ -14,7 +14,7 @@ import rest from './internal/rest';
* @memberOf module:ControlFlow
* @method
* @category Control Flow
* @param {...Function} functions - the asynchronous functions to compose
* @param {...AsyncFunction} functions - the asynchronous functions to compose

This comment has been minimized.

Copy link
@megawac

megawac Apr 2, 2017

Collaborator

does this need a @link

This comment has been minimized.

Copy link
@aearly

aearly Apr 2, 2017

Author Collaborator

Nope.

* @returns {Function} an asynchronous function that is the composed
* asynchronous `functions`
* @example
Expand Down
6 changes: 2 additions & 4 deletions lib/concat.js
Expand Up @@ -14,10 +14,8 @@ import doParallel from './internal/doParallel';
* @method
* @category Collection
* @param {Array|Iterable|Object} coll - A collection to iterate over.
* @param {Function} iteratee - A function to apply to each item in `coll`.
* The iteratee is passed a `callback(err, results)` which must be called once
* it has completed with an error (which can be `null`) and an array of results.
* Invoked with (item, callback).
* @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
* which should use an array as its result. Invoked with (item, callback).
* @param {Function} [callback(err)] - A callback which is called after all the
* `iteratee` functions have finished, or an error occurs. Results is an array
* containing the concatenated results of the `iteratee` function. Invoked with
Expand Down
5 changes: 2 additions & 3 deletions lib/concatSeries.js
Expand Up @@ -11,9 +11,8 @@ import doSeries from './internal/doSeries';
* @see [async.concat]{@link module:Collections.concat}
* @category Collection
* @param {Array|Iterable|Object} coll - A collection to iterate over.
* @param {Function} iteratee - A function to apply to each item in `coll`.
* The iteratee is passed a `callback(err, results)` which must be called once
* it has completed with an error (which can be `null`) and an array of results.
* @param {AsyncFunction} iteratee - A function to apply to each item in `coll`.
* The iteratee should complete with an array an array of results.
* Invoked with (item, callback).
* @param {Function} [callback(err)] - A callback which is called after all the
* `iteratee` functions have finished, or an error occurs. Results is an array
Expand Down
2 changes: 1 addition & 1 deletion lib/constant.js
Expand Up @@ -13,7 +13,7 @@ import initialParams from './internal/initialParams';
* @category Util
* @param {...*} arguments... - Any number of arguments to automatically invoke
* callback with.
* @returns {Function} Returns a function that when invoked, automatically
* @returns {AsyncFunction} Returns a function that when invoked, automatically
* invokes the callback with the previous given arguments.
* @example
*
Expand Down
6 changes: 3 additions & 3 deletions lib/detect.js
Expand Up @@ -21,9 +21,9 @@ import findGetResult from './internal/findGetResult';
* @alias find
* @category Collections
* @param {Array|Iterable|Object} coll - A collection to iterate over.
* @param {Function} iteratee - A truth test to apply to each item in `coll`.
* The iteratee is passed a `callback(err, truthValue)` which must be called
* with a boolean argument once it has completed. Invoked with (item, callback).
* @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
* The iteratee must complete with a boolean value as its result.
* Invoked with (item, callback).
* @param {Function} [callback] - A callback which is called as soon as any
* iteratee returns `true`, or after all the `iteratee` functions have finished.
* Result will be the first item in the array that passes the truth test
Expand Down
6 changes: 3 additions & 3 deletions lib/detectLimit.js
Expand Up @@ -17,9 +17,9 @@ import findGetResult from './internal/findGetResult';
* @category Collections
* @param {Array|Iterable|Object} coll - A collection to iterate over.
* @param {number} limit - The maximum number of async operations at a time.
* @param {Function} iteratee - A truth test to apply to each item in `coll`.
* The iteratee is passed a `callback(err, truthValue)` which must be called
* with a boolean argument once it has completed. Invoked with (item, callback).
* @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
* The iteratee must complete with a boolean value as its result.
* Invoked with (item, callback).
* @param {Function} [callback] - A callback which is called as soon as any
* iteratee returns `true`, or after all the `iteratee` functions have finished.
* Result will be the first item in the array that passes the truth test
Expand Down
6 changes: 3 additions & 3 deletions lib/detectSeries.js
Expand Up @@ -12,9 +12,9 @@ import doLimit from './internal/doLimit';
* @alias findSeries
* @category Collections
* @param {Array|Iterable|Object} coll - A collection to iterate over.
* @param {Function} iteratee - A truth test to apply to each item in `coll`.
* The iteratee is passed a `callback(err, truthValue)` which must be called
* with a boolean argument once it has completed. Invoked with (item, callback).
* @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
* The iteratee must complete with a boolean value as its result.
* Invoked with (item, callback).
* @param {Function} [callback] - A callback which is called as soon as any
* iteratee returns `true`, or after all the `iteratee` functions have finished.
* Result will be the first item in the array that passes the truth test
Expand Down
13 changes: 7 additions & 6 deletions lib/dir.js
@@ -1,19 +1,20 @@
import consoleFunc from './internal/consoleFunc';

/**
* Logs the result of an `async` function to the `console` using `console.dir`
* to display the properties of the resulting object. Only works in Node.js or
* in browsers that support `console.dir` and `console.error` (such as FF and
* Chrome). If multiple arguments are returned from the async function,
* Logs the result of an [`async` function]{@link AsyncFunction} to the
* `console` using `console.dir` to display the properties of the resulting object.
* Only works in Node.js or in browsers that support `console.dir` and
* `console.error` (such as FF and Chrome).
* If multiple arguments are returned from the async function,
* `console.dir` is called on each argument in order.
*
* @name dir
* @static
* @memberOf module:Utils
* @method
* @category Util
* @param {Function} function - The function you want to eventually apply all
* arguments to.
* @param {AsyncFunction} function - The function you want to eventually apply
* all arguments to.
* @param {...*} arguments... - Any number of arguments to apply to the function.
* @example
*
Expand Down
7 changes: 3 additions & 4 deletions lib/doDuring.js
Expand Up @@ -14,10 +14,9 @@ import wrapAsync from './internal/wrapAsync';
* @method
* @see [async.during]{@link module:ControlFlow.during}
* @category Control Flow
* @param {Function} fn - A function which is called each time `test` passes.
* The function is passed a `callback(err)`, which must be called once it has
* completed with an optional `err` argument. Invoked with (callback).
* @param {Function} test - asynchronous truth test to perform before each
* @param {AsyncFunction} fn - An async function which is called each time
* `test` passes. Invoked with (callback).
* @param {AsyncFunction} test - asynchronous truth test to perform before each
* execution of `fn`. Invoked with (...args, callback), where `...args` are the
* non-error args from the previous callback of `fn`.
* @param {Function} [callback] - A callback which is called after the test
Expand Down
16 changes: 8 additions & 8 deletions lib/doUntil.js
Expand Up @@ -10,18 +10,18 @@ import doWhilst from './doWhilst';
* @method
* @see [async.doWhilst]{@link module:ControlFlow.doWhilst}
* @category Control Flow
* @param {Function} fn - A function which is called each time `test` fails.
* The function is passed a `callback(err)`, which must be called once it has
* completed with an optional `err` argument. Invoked with (callback).
* @param {AsyncFunction} iteratee - An async function which is called each time
* `test` fails. Invoked with (callback).
* @param {Function} test - synchronous truth test to perform after each
* execution of `fn`. Invoked with the non-error callback results of `fn`.
* execution of `iteratee`. Invoked with any non-error callback results of
* `iteratee`.
* @param {Function} [callback] - A callback which is called after the test
* function has passed and repeated execution of `fn` has stopped. `callback`
* will be passed an error and any arguments passed to the final `fn`'s
* function has passed and repeated execution of `iteratee` has stopped. `callback`
* will be passed an error and any arguments passed to the final `iteratee`'s
* callback. Invoked with (err, [results]);
*/
export default function doUntil(fn, test, callback) {
doWhilst(fn, function() {
export default function doUntil(iteratee, test, callback) {
doWhilst(iteratee, function() {
return !test.apply(this, arguments);
}, callback);
}
7 changes: 3 additions & 4 deletions lib/doWhilst.js
Expand Up @@ -16,11 +16,10 @@ import wrapAsync from './internal/wrapAsync';
* @method
* @see [async.whilst]{@link module:ControlFlow.whilst}
* @category Control Flow
* @param {Function} iteratee - A function which is called each time `test`
* passes. The function is passed a `callback(err)`, which must be called once
* it has completed with an optional `err` argument. Invoked with (callback).
* @param {AsyncFunction} iteratee - A function which is called each time `test`
* passes. Invoked with (callback).
* @param {Function} test - synchronous truth test to perform after each
* execution of `iteratee`. Invoked with the non-error callback results of
* execution of `iteratee`. Invoked with any non-error callback results of
* `iteratee`.
* @param {Function} [callback] - A callback which is called after the test
* function has failed and repeated execution of `iteratee` has stopped.
Expand Down
7 changes: 3 additions & 4 deletions lib/during.js
Expand Up @@ -14,11 +14,10 @@ import wrapAsync from './internal/wrapAsync';
* @method
* @see [async.whilst]{@link module:ControlFlow.whilst}
* @category Control Flow
* @param {Function} test - asynchronous truth test to perform before each
* @param {AsyncFunction} test - asynchronous truth test to perform before each
* execution of `fn`. Invoked with (callback).
* @param {Function} fn - A function which is called each time `test` passes.
* The function is passed a `callback(err)`, which must be called once it has
* completed with an optional `err` argument. Invoked with (callback).
* @param {AsyncFunction} fn - An async function which is called each time
* `test` passes. Invoked with (callback).
* @param {Function} [callback] - A callback which is called after the test
* function has failed and repeated execution of `fn` has stopped. `callback`
* will be passed an error, if one occured, otherwise `null`.
Expand Down
11 changes: 5 additions & 6 deletions lib/eachLimit.js
Expand Up @@ -14,12 +14,11 @@ import wrapAsync from './internal/wrapAsync';
* @category Collection
* @param {Array|Iterable|Object} coll - A collection to iterate over.
* @param {number} limit - The maximum number of async operations at a time.
* @param {Function} iteratee - A function to apply to each item in `coll`. The
* iteratee is passed a `callback(err)` which must be called once it has
* completed. If no error has occurred, the `callback` should be run without
* arguments or with an explicit `null` argument. The array index is not passed
* to the iteratee. Invoked with (item, callback). If you need the index, use
* `eachOfLimit`.
* @param {AsyncFunction} iteratee - An async function to apply to each item in
* `coll`.
* The array index is not passed to the iteratee.
* If you need the index, use `eachOfLimit`.
* Invoked with (item, callback).
* @param {Function} [callback] - A callback which is called when all
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
*/
Expand Down
10 changes: 4 additions & 6 deletions lib/eachOf.js
Expand Up @@ -46,12 +46,10 @@ var eachOfGeneric = doLimit(eachOfLimit, Infinity);
* @category Collection
* @see [async.each]{@link module:Collections.each}
* @param {Array|Iterable|Object} coll - A collection to iterate over.
* @param {Function} iteratee - A function to apply to each
* item in `coll`. The `key` is the item's key, or index in the case of an
* array. The iteratee is passed a `callback(err)` which must be called once it
* has completed. If no error has occurred, the callback should be run without
* arguments or with an explicit `null` argument. Invoked with
* (item, key, callback).
* @param {AsyncFunction} iteratee - A function to apply to each
* item in `coll`.
* The `key` is the item's key, or index in the case of an array.
* Invoked with (item, key, callback).
* @param {Function} [callback] - A callback which is called when all
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
* @example
Expand Down
8 changes: 3 additions & 5 deletions lib/eachOfLimit.js
Expand Up @@ -14,12 +14,10 @@ import wrapAsync from './internal/wrapAsync';
* @category Collection
* @param {Array|Iterable|Object} coll - A collection to iterate over.
* @param {number} limit - The maximum number of async operations at a time.
* @param {Function} iteratee - A function to apply to each
* @param {AsyncFunction} iteratee - An async function to apply to each
* item in `coll`. The `key` is the item's key, or index in the case of an
* array. The iteratee is passed a `callback(err)` which must be called once it
* has completed. If no error has occurred, the callback should be run without
* arguments or with an explicit `null` argument. Invoked with
* (item, key, callback).
* array.
* Invoked with (item, key, callback).
* @param {Function} [callback] - A callback which is called when all
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
*/
Expand Down
8 changes: 3 additions & 5 deletions lib/eachOfSeries.js
Expand Up @@ -12,11 +12,9 @@ import doLimit from './internal/doLimit';
* @alias forEachOfSeries
* @category Collection
* @param {Array|Iterable|Object} coll - A collection to iterate over.
* @param {Function} iteratee - A function to apply to each item in `coll`. The
* `key` is the item's key, or index in the case of an array. The iteratee is
* passed a `callback(err)` which must be called once it has completed. If no
* error has occurred, the callback should be run without arguments or with an
* explicit `null` argument. Invoked with (item, key, callback).
* @param {AsyncFunction} iteratee - An async function to apply to each item in
* `coll`.
* Invoked with (item, key, callback).
* @param {Function} [callback] - A callback which is called when all `iteratee`
* functions have finished, or an error occurs. Invoked with (err).
*/
Expand Down
11 changes: 5 additions & 6 deletions lib/eachSeries.js
Expand Up @@ -12,12 +12,11 @@ import doLimit from './internal/doLimit';
* @alias forEachSeries
* @category Collection
* @param {Array|Iterable|Object} coll - A collection to iterate over.
* @param {Function} iteratee - A function to apply to each
* item in `coll`. The iteratee is passed a `callback(err)` which must be called
* once it has completed. If no error has occurred, the `callback` should be run
* without arguments or with an explicit `null` argument. The array index is
* not passed to the iteratee. Invoked with (item, callback). If you need the
* index, use `eachOfSeries`.
* @param {AsyncFunction} iteratee - An async function to apply to each
* item in `coll`.
* The array index is not passed to the iteratee.
* If you need the index, use `eachOfSeries`.
* Invoked with (item, callback).
* @param {Function} [callback] - A callback which is called when all
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
*/
Expand Down

0 comments on commit 94a8b2d

Please sign in to comment.