diff options
Diffstat (limited to 'lib')
74 files changed, 318 insertions, 189 deletions
diff --git a/lib/apply.js b/lib/apply.js index 1cf7cb3..465ed10 100644 --- a/lib/apply.js +++ b/lib/apply.js @@ -9,7 +9,8 @@ import rest from 'lodash/rest'; * * @name apply * @static - * @memberOf async + * @memberOf module:Utils + * @method * @category Util * @param {Function} function - The function you want to eventually apply all * arguments to. Invokes with (arguments...). diff --git a/lib/applyEach.js b/lib/applyEach.js index 3337f57..c106114 100644 --- a/lib/applyEach.js +++ b/lib/applyEach.js @@ -9,7 +9,8 @@ import map from './map'; * * @name applyEach * @static - * @memberOf async + * @memberOf module:ControlFlow + * @method * @category Control Flow * @param {Array|Object} fns - A collection of asynchronous functions to all * call with the same arguments diff --git a/lib/applyEachSeries.js b/lib/applyEachSeries.js index 0a01891..f0919cb 100644 --- a/lib/applyEachSeries.js +++ b/lib/applyEachSeries.js @@ -2,12 +2,13 @@ import applyEach from './internal/applyEach'; import mapSeries from './mapSeries'; /** - * The same as `applyEach` but runs only a single async operation at a time. + * The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time. * * @name applyEachSeries * @static - * @memberOf async - * @see async.applyEach + * @memberOf module:ControlFlow + * @method + * @see [async.applyEach]{@link module:ControlFlow.applyEach} * @category Control Flow * @param {Array|Object} fns - A collection of asynchronous functions to all * call with the same arguments diff --git a/lib/asyncify.js b/lib/asyncify.js index 089f94b..dec39d2 100644 --- a/lib/asyncify.js +++ b/lib/asyncify.js @@ -16,7 +16,8 @@ import initialParams from './internal/initialParams'; * * @name asyncify * @static - * @memberOf async + * @memberOf module:Utils + * @method * @alias wrapSync * @category Util * @param {Function} func - The synchronous function to convert to an diff --git a/lib/auto.js b/lib/auto.js index bb8ee87..ce9f259 100644 --- a/lib/auto.js +++ b/lib/auto.js @@ -26,7 +26,8 @@ import onlyOnce from './internal/onlyOnce'; * * @name auto * @static - * @memberOf async + * @memberOf module:ControlFlow + * @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 diff --git a/lib/autoInject.js b/lib/autoInject.js index 96922ba..31bd622 100644 --- a/lib/autoInject.js +++ b/lib/autoInject.js @@ -21,7 +21,7 @@ function parseParams(func) { } /** - * A dependency-injected version of the {@link async.auto} function. Dependent + * A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent * tasks are specified as parameters to the function, after the usual callback * parameter, with the parameter names matching the names of the tasks it * depends on. This can provide even more readable task graphs which can be @@ -31,12 +31,13 @@ function parseParams(func) { * specified as named parameters after the initial error parameter. * * The autoInject function is purely syntactic sugar and its semantics are - * otherwise equivalent to {@link async.auto}. + * otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}. * * @name autoInject * @static - * @memberOf async - * @see async.auto + * @memberOf module:ControlFlow + * @method + * @see [async.auto]{@link module:ControlFlow.auto} * @category Control Flow * @param {Object} tasks - An object, each of whose properties is a function of * the form 'func([dependencies...], callback). The object's key of a property diff --git a/lib/cargo.js b/lib/cargo.js index 01329e7..d86cb67 100644 --- a/lib/cargo.js +++ b/lib/cargo.js @@ -2,17 +2,18 @@ import queue from './internal/queue'; /** * A cargo of tasks for the worker function to complete. Cargo inherits all of - * the same methods and event callbacks as {@link async.queue}. - * @typedef {Object} cargo + * the same methods and event callbacks as [`queue`]{@link module:ControlFlow.queue}. + * @typedef {Object} CargoObject + * @memberOf module:ControlFlow * @property {Function} length - A function returning the number of items - * waiting to be processed. Invoke with (). + * waiting to be processed. Invoke like `cargo.length()`. * @property {number} payload - An `integer` for determining how many tasks * should be process per round. This property can be changed after a `cargo` is * created to alter the payload on-the-fly. * @property {Function} push - Adds `task` to the `queue`. The callback is * called once the `worker` has finished processing the task. Instead of a * single task, an array of `tasks` can be submitted. The respective callback is - * used for every task in the list. Invoke with (task, [callback]). + * used for every task in the list. Invoke like `cargo.push(task, [callback])`. * @property {Function} saturated - A callback that is called when the * `queue.length()` hits the concurrency and further tasks will be queued. * @property {Function} empty - A callback that is called when the last item @@ -20,13 +21,13 @@ import queue from './internal/queue'; * @property {Function} drain - A callback that is called when the last item * from the `queue` has returned from the `worker`. * @property {Function} idle - a function returning false if there are items - * waiting or being processed, or true if not. Invoke with (). + * waiting or being processed, or true if not. Invoke like `cargo.idle()`. * @property {Function} pause - a function that pauses the processing of tasks - * until `resume()` is called. Invoke with (). + * until `resume()` is called. Invoke like `cargo.pause()`. * @property {Function} resume - a function that resumes the processing of - * queued tasks when the queue is paused. Invoke with (). + * queued tasks when the queue is paused. Invoke like `cargo.resume()`. * @property {Function} kill - a function that removes the `drain` callback and - * empties remaining tasks from the queue forcing it to go idle. Invoke with (). + * empties remaining tasks from the queue forcing it to go idle. Invoke like `cargo.kill()`. */ /** @@ -37,22 +38,23 @@ import queue from './internal/queue'; * called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) * for how `cargo` and `queue` work. * - * While [queue](#queue) passes only one task to one of a group of workers + * While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers * at a time, cargo passes an array of tasks to a single worker, repeating * when the worker is finished. * * @name cargo * @static - * @memberOf async - * @see async.queue + * @memberOf module:ControlFlow + * @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). + * with an optional `err` argument. 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. - * @returns {cargo} A cargo object to manage the tasks. Callbacks can + * @returns {module:ControlFlow.CargoObject} A cargo object to manage the tasks. Callbacks can * attached as certain properties to listen for specific events during the * lifecycle of the cargo and inner queue. * @example diff --git a/lib/compose.js b/lib/compose.js index 227c2ea..ff2e0ab 100644 --- a/lib/compose.js +++ b/lib/compose.js @@ -12,7 +12,8 @@ var reverse = Array.prototype.reverse; * * @name compose * @static - * @memberOf async + * @memberOf module:ControlFlow + * @method * @category Control Flow * @param {...Function} functions - the asynchronous functions to compose * @returns {Function} an asynchronous function that is the composed diff --git a/lib/concat.js b/lib/concat.js index be7410d..db23737 100644 --- a/lib/concat.js +++ b/lib/concat.js @@ -10,7 +10,8 @@ import doParallel from './internal/doParallel'; * * @name concat * @static - * @memberOf async + * @memberOf module:Collections + * @method * @category Collection * @param {Array|Object} coll - A collection to iterate over. * @param {Function} iteratee - A function to apply to each item in `coll`. diff --git a/lib/concatSeries.js b/lib/concatSeries.js index fef87b7..c5dfb61 100644 --- a/lib/concatSeries.js +++ b/lib/concatSeries.js @@ -2,12 +2,13 @@ import concat from './internal/concat'; import doSeries from './internal/doSeries'; /** - * The same as `concat` but runs only a single async operation at a time. + * The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time. * * @name concatSeries * @static - * @memberOf async - * @see async.concat + * @memberOf module:Collections + * @method + * @see [async.concat]{@link module:Collections.concat} * @category Collection * @param {Array|Object} coll - A collection to iterate over. * @param {Function} iteratee - A function to apply to each item in `coll`. diff --git a/lib/constant.js b/lib/constant.js index a5e32fa..c7dd50f 100644 --- a/lib/constant.js +++ b/lib/constant.js @@ -3,12 +3,13 @@ import initialParams from './internal/initialParams'; /** * Returns a function that when called, calls-back with the values provided. - * Useful as the first function in a `waterfall`, or for plugging values in to - * `auto`. + * Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to + * [`auto`]{@link module:ControlFlow.auto}. * * @name constant * @static - * @memberOf async + * @memberOf module:Utils + * @method * @category Util * @param {...*} arguments... - Any number of arguments to automatically invoke * callback with. diff --git a/lib/detect.js b/lib/detect.js index a4e246c..3aff790 100644 --- a/lib/detect.js +++ b/lib/detect.js @@ -12,13 +12,14 @@ import findGetResult from './internal/findGetResult'; * that passes the test. * If order within the original `coll` is important, then look at - * `detectSeries`. + * [`detectSeries`]{@link module:Collections.detectSeries}. * * @name detect * @static - * @memberOf async + * @memberOf module:Collections + * @method * @alias find - * @category Collection + * @category Collections * @param {Array|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 diff --git a/lib/detectLimit.js b/lib/detectLimit.js index 2e8ba7a..da54bd6 100644 --- a/lib/detectLimit.js +++ b/lib/detectLimit.js @@ -5,15 +5,16 @@ import eachOfLimit from './eachOfLimit'; import findGetResult from './internal/findGetResult'; /** - * The same as `detect` but runs a maximum of `limit` async operations at a + * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a * time. * * @name detectLimit * @static - * @memberOf async - * @see async.detect + * @memberOf module:Collections + * @method + * @see [async.detect]{@link module:Collections.detect} * @alias findLimit - * @category Collection + * @category Collections * @param {Array|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`. diff --git a/lib/detectSeries.js b/lib/detectSeries.js index 59b34a5..fd29343 100644 --- a/lib/detectSeries.js +++ b/lib/detectSeries.js @@ -5,14 +5,15 @@ import eachOfSeries from './eachOfSeries'; import findGetResult from './internal/findGetResult'; /** - * The same as `detect` but runs only a single async operation at a time. + * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time. * * @name detectSeries * @static - * @memberOf async - * @see async.detect + * @memberOf module:Collections + * @method + * @see [async.detect]{@link module:Collections.detect} * @alias findSeries - * @category Collection + * @category Collections * @param {Array|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 @@ -7,9 +7,10 @@ import consoleFunc from './internal/consoleFunc'; * Chrome). If multiple arguments are returned from the async function, * `console.dir` is called on each argument in order. * - * @name log + * @name dir * @static - * @memberOf async + * @memberOf module:Utils + * @method * @category Util * @param {Function} function - The function you want to eventually apply all * arguments to. diff --git a/lib/doDuring.js b/lib/doDuring.js index e018fe4..d12d668 100644 --- a/lib/doDuring.js +++ b/lib/doDuring.js @@ -1,14 +1,15 @@ import during from './during'; /** - * The post-check version of {@link async.during}. To reflect the difference in + * The post-check version of [`during`]{@link module:ControlFlow.during}. To reflect the difference in * the order of operations, the arguments `test` and `fn` are switched. * - * Also a version of {@link async.doWhilst} with asynchronous `test` function. + * Also a version of [`doWhilst`]{@link module:ControlFlow.doWhilst} with asynchronous `test` function. * @name doDuring * @static - * @memberOf async - * @see async.during + * @memberOf module:ControlFlow + * @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 diff --git a/lib/doUntil.js b/lib/doUntil.js index 01f114c..0c5bb71 100644 --- a/lib/doUntil.js +++ b/lib/doUntil.js @@ -1,13 +1,14 @@ import doWhilst from './doWhilst'; /** - * Like {@link async.doWhilst}, except the `test` is inverted. Note the + * Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the * argument ordering differs from `until`. * * @name doUntil * @static - * @memberOf async - * @see async.doWhilst + * @memberOf module:ControlFlow + * @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 diff --git a/lib/doWhilst.js b/lib/doWhilst.js index 96c4664..a425999 100644 --- a/lib/doWhilst.js +++ b/lib/doWhilst.js @@ -1,15 +1,16 @@ import whilst from './whilst'; /** - * The post-check version of {@link async.whilst}. To reflect the difference in + * The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in * the order of operations, the arguments `test` and `fn` are switched. * * `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. * * @name doWhilst * @static - * @memberOf async - * @see async.whilst + * @memberOf module:ControlFlow + * @method + * @see [async.whilst]{@link module:ControlFlow.whilst} * @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 diff --git a/lib/during.js b/lib/during.js index 1013bc8..55af1b9 100644 --- a/lib/during.js +++ b/lib/during.js @@ -2,15 +2,16 @@ import noop from 'lodash/noop'; import rest from 'lodash/rest'; /** - * Like {@link async.whilst}, except the `test` is an asynchronous function that + * Like [`whilst`]{@link module:ControlFlow.whilst}, except the `test` is an asynchronous function that * is passed a callback in the form of `function (err, truth)`. If error is * passed to `test` or `fn`, the main callback is immediately called with the * value of the error. * * @name during * @static - * @memberOf async - * @see async.whilst + * @memberOf module:ControlFlow + * @method + * @see [async.whilst]{@link module:ControlFlow.whilst} * @category Control Flow * @param {Function} test - asynchronous truth test to perform before each * execution of `fn`. Invoked with (callback). diff --git a/lib/each.js b/lib/each.js index 90ba3ee..aab1d3d 100644 --- a/lib/each.js +++ b/lib/each.js @@ -13,7 +13,8 @@ import doLimit from './internal/doLimit'; * * @name each * @static - * @memberOf async + * @memberOf module:Collections + * @method * @alias forEach * @category Collection * @param {Array|Object} coll - A collection to iterate over. diff --git a/lib/eachLimit.js b/lib/eachLimit.js index d5f200c..a46eb9d 100644 --- a/lib/eachLimit.js +++ b/lib/eachLimit.js @@ -2,12 +2,13 @@ import eachOfLimit from './internal/eachOfLimit'; import withoutIndex from './internal/withoutIndex'; /** - * The same as `each` but runs a maximum of `limit` async operations at a time. + * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time. * * @name eachLimit * @static - * @memberOf async - * @see async.each + * @memberOf module:Collections + * @method + * @see [async.each]{@link module:Collections.each} * @alias forEachLimit * @category Collection * @param {Array|Object} coll - A colleciton to iterate over. diff --git a/lib/eachOf.js b/lib/eachOf.js index 1defd47..b51fefb 100644 --- a/lib/eachOf.js +++ b/lib/eachOf.js @@ -2,14 +2,16 @@ import eachOfLimit from './eachOfLimit'; import doLimit from './internal/doLimit'; /** - * Like `each`, except that it passes the key (or index) as the second argument + * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument * to the iteratee. * * @name eachOf * @static - * @memberOf async + * @memberOf module:Collections + * @method * @alias forEachOf * @category Collection + * @see [async.each]{@link module:Collections.each} * @param {Array|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 diff --git a/lib/eachOfLimit.js b/lib/eachOfLimit.js index 5810f8f..55d60e3 100644 --- a/lib/eachOfLimit.js +++ b/lib/eachOfLimit.js @@ -1,13 +1,14 @@ import _eachOfLimit from './internal/eachOfLimit'; /** - * The same as `eachOf` but runs a maximum of `limit` async operations at a + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a * time. * * @name eachOfLimit * @static - * @memberOf async - * @see async.eachOf + * @memberOf module:Collections + * @method + * @see [async.eachOf]{@link module:Collections.eachOf} * @alias forEachOfLimit * @category Collection * @param {Array|Object} coll - A collection to iterate over. diff --git a/lib/eachOfSeries.js b/lib/eachOfSeries.js index dee4838..32003a8 100644 --- a/lib/eachOfSeries.js +++ b/lib/eachOfSeries.js @@ -2,12 +2,13 @@ import eachOfLimit from './eachOfLimit'; import doLimit from './internal/doLimit'; /** - * The same as `eachOf` but runs only a single async operation at a time. + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time. * * @name eachOfSeries * @static - * @memberOf async - * @see async.eachOf + * @memberOf module:Collections + * @method + * @see [async.eachOf]{@link module:Collections.eachOf} * @alias forEachOfSeries * @category Collection * @param {Array|Object} coll - A collection to iterate over. diff --git a/lib/eachSeries.js b/lib/eachSeries.js index 3d8af62..1b8e589 100644 --- a/lib/eachSeries.js +++ b/lib/eachSeries.js @@ -2,12 +2,13 @@ import eachLimit from './eachLimit'; import doLimit from './internal/doLimit'; /** - * The same as `each` but runs only a single async operation at a time. + * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time. * * @name eachSeries * @static - * @memberOf async - * @see async.each + * @memberOf module:Collections + * @method + * @see [async.each]{@link module:Collections.each} * @alias forEachSeries * @category Collection * @param {Array|Object} coll - A collection to iterate over. diff --git a/lib/ensureAsync.js b/lib/ensureAsync.js index 55d59fe..c60d07e 100644 --- a/lib/ensureAsync.js +++ b/lib/ensureAsync.js @@ -11,7 +11,8 @@ import initialParams from './internal/initialParams'; * * @name ensureAsync * @static - * @memberOf async + * @memberOf module:Utils + * @method * @category Util * @param {Function} fn - an async function, one that expects a node-style * callback as its last argument. diff --git a/lib/every.js b/lib/every.js index a2377ea..147c54a 100644 --- a/lib/every.js +++ b/lib/every.js @@ -7,7 +7,8 @@ import doLimit from './internal/doLimit'; * * @name every * @static - * @memberOf async + * @memberOf module:Collections + * @method * @alias all * @category Collection * @param {Array|Object} coll - A collection to iterate over. diff --git a/lib/everyLimit.js b/lib/everyLimit.js index 7d2b042..1ba2858 100644 --- a/lib/everyLimit.js +++ b/lib/everyLimit.js @@ -3,12 +3,13 @@ import eachOfLimit from './eachOfLimit'; import notId from './internal/notId'; /** - * The same as `every` but runs a maximum of `limit` async operations at a time. + * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time. * * @name everyLimit * @static - * @memberOf async - * @see async.every + * @memberOf module:Collections + * @method + * @see [async.every]{@link module:Collections.every} * @alias allLimit * @category Collection * @param {Array|Object} coll - A collection to iterate over. diff --git a/lib/everySeries.js b/lib/everySeries.js index 24ee4ed..3cdadf0 100644 --- a/lib/everySeries.js +++ b/lib/everySeries.js @@ -2,12 +2,13 @@ import everyLimit from './everyLimit'; import doLimit from './internal/doLimit'; /** - * The same as `every` but runs only a single async operation at a time. + * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time. * * @name everySeries * @static - * @memberOf async - * @see async.every + * @memberOf module:Collections + * @method + * @see [async.every]{@link module:Collections.every} * @alias allSeries * @category Collection * @param {Array|Object} coll - A collection to iterate over. diff --git a/lib/filter.js b/lib/filter.js index 7f48ae1..b858fea 100644 --- a/lib/filter.js +++ b/lib/filter.js @@ -8,7 +8,8 @@ import doLimit from './internal/doLimit'; * * @name filter * @static - * @memberOf async + * @memberOf module:Collections + * @method * @alias select * @category Collection * @param {Array|Object} coll - A collection to iterate over. diff --git a/lib/filterLimit.js b/lib/filterLimit.js index 615b170..6d429e8 100644 --- a/lib/filterLimit.js +++ b/lib/filterLimit.js @@ -2,13 +2,14 @@ import filter from './internal/filter'; import doParallelLimit from './internal/doParallelLimit'; /** - * The same as `filter` but runs a maximum of `limit` async operations at a + * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a * time. * * @name filterLimit * @static - * @memberOf async - * @see async.filter + * @memberOf module:Collections + * @method + * @see [async.filter]{@link module:Collections.filter} * @alias selectLimit * @category Collection * @param {Array|Object} coll - A collection to iterate over. diff --git a/lib/filterSeries.js b/lib/filterSeries.js index 6fde694..781e4eb 100644 --- a/lib/filterSeries.js +++ b/lib/filterSeries.js @@ -2,12 +2,13 @@ import filterLimit from './filterLimit'; import doLimit from './internal/doLimit'; /** - * The same as `filter` but runs only a single async operation at a time. + * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time. * * @name filterSeries * @static - * @memberOf async - * @see async.filter + * @memberOf module:Collections + * @method + * @see [async.filter]{@link module:Collections.filter} * @alias selectSeries * @category Collection * @param {Array|Object} coll - A collection to iterate over. diff --git a/lib/forever.js b/lib/forever.js index 4708d21..0147395 100644 --- a/lib/forever.js +++ b/lib/forever.js @@ -13,7 +13,8 @@ import ensureAsync from './ensureAsync'; * * @name forever * @static - * @memberOf async + * @memberOf module:ControlFlow + * @method * @category Control Flow * @param {Function} fn - a function to call repeatedly. Invoked with (next). * @param {Function} [errback] - when `fn` passes an error to it's callback, diff --git a/lib/index.js b/lib/index.js index 091f657..28b87d6 100644 --- a/lib/index.js +++ b/lib/index.js @@ -5,6 +5,22 @@ * `npm install --save async`, it can also be used directly in the browser. * @module async */ + +/** + * A collection of `async` functions for manipulating collections, such as + * arrays and objects. + * @module Collections + */ + +/** + * A collection of `async` functions for controlling the flow through a script. + * @module ControlFlow + */ + + /** + * A collection of `async` utility functions. + * @module Utils + */ import applyEach from './applyEach'; import applyEachSeries from './applyEachSeries'; import apply from './apply'; diff --git a/lib/iterator.js b/lib/iterator.js index b37c18a..fafd960 100644 --- a/lib/iterator.js +++ b/lib/iterator.js @@ -8,7 +8,8 @@ * * @name iterator * @static - * @memberOf async + * @memberOf module:ControlFlow + * @method * @category Control Flow * @param {Array} tasks - An array of functions to run. * @returns The next function to run in the series. @@ -8,7 +8,8 @@ import consoleFunc from './internal/consoleFunc'; * * @name log * @static - * @memberOf async + * @memberOf module:Utils + * @method * @category Util * @param {Function} function - The function you want to eventually apply all * arguments to. @@ -20,7 +20,8 @@ import doLimit from './internal/doLimit'; * * @name map * @static - * @memberOf async + * @memberOf module:Collections + * @method * @category Collection * @param {Array|Object} coll - A collection to iterate over. * @param {Function} iteratee - A function to apply to each item in `coll`. diff --git a/lib/mapLimit.js b/lib/mapLimit.js index 0cf049b..efaff2b 100644 --- a/lib/mapLimit.js +++ b/lib/mapLimit.js @@ -2,12 +2,13 @@ import doParallelLimit from './internal/doParallelLimit'; import map from './internal/map'; /** - * The same as `map` but runs a maximum of `limit` async operations at a time. + * The same as [`map`]{@link module:Collections.map} but runs a maximum of `limit` async operations at a time. * * @name mapLimit * @static - * @memberOf async - * @see async.map + * @memberOf module:Collections + * @method + * @see [async.map]{@link module:Collections.map} * @category Collection * @param {Array|Object} coll - A collection to iterate over. * @param {number} limit - The maximum number of async operations at a time. diff --git a/lib/mapSeries.js b/lib/mapSeries.js index c241bef..24ce126 100644 --- a/lib/mapSeries.js +++ b/lib/mapSeries.js @@ -2,12 +2,13 @@ import mapLimit from './mapLimit'; import doLimit from './internal/doLimit'; /** - * The same as `map` but runs only a single async operation at a time. + * The same as [`map`]{@link module:Collections.map} but runs only a single async operation at a time. * * @name mapSeries * @static - * @memberOf async - * @see async.map + * @memberOf module:Collections + * @method + * @see [async.map]{@link module:Collections.map} * @category Collection * @param {Array|Object} coll - A collection to iterate over. * @param {Function} iteratee - A function to apply to each item in `coll`. diff --git a/lib/mapValues.js b/lib/mapValues.js index 83ffc43..240fc67 100644 --- a/lib/mapValues.js +++ b/lib/mapValues.js @@ -3,7 +3,7 @@ import doLimit from './internal/doLimit'; /** - * A relative of `map`, designed for use with objects. + * A relative of [`map`]{@link module:Collections.map}, designed for use with objects. * * Produces a new Object by mapping each value of `obj` through the `iteratee` * function. The `iteratee` is called each `value` and `key` from `obj` and a @@ -17,7 +17,8 @@ import doLimit from './internal/doLimit'; * * @name mapValues * @static - * @memberOf async + * @memberOf module:Collections + * @method * @category Collection * @param {Object} obj - A collection to iterate over. * @param {Function} iteratee - A function to apply to each value and key in diff --git a/lib/mapValuesLimit.js b/lib/mapValuesLimit.js index 762b871..bced034 100644 --- a/lib/mapValuesLimit.js +++ b/lib/mapValuesLimit.js @@ -1,13 +1,14 @@ import eachOfLimit from './eachOfLimit'; /** - * The same as `mapValues` but runs a maximum of `limit` async operations at a + * The same as [`mapValues`]{@link module:Collections.mapValues} but runs a maximum of `limit` async operations at a * time. * * @name mapValuesLimit * @static - * @memberOf async - * @see async.mapValues + * @memberOf module:Collections + * @method + * @see [async.mapValues]{@link module:Collections.mapValues} * @category Collection * @param {Object} obj - A collection to iterate over. * @param {number} limit - The maximum number of async operations at a time. diff --git a/lib/mapValuesSeries.js b/lib/mapValuesSeries.js index 163d474..b97fcd1 100644 --- a/lib/mapValuesSeries.js +++ b/lib/mapValuesSeries.js @@ -2,12 +2,13 @@ import mapValuesLimit from './mapValuesLimit'; import doLimit from './internal/doLimit'; /** - * The same as `mapValues` but runs only a single async operation at a time. + * The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async operation at a time. * * @name mapValuesSeries * @static - * @memberOf async - * @see async.mapValues + * @memberOf module:Collections + * @method + * @see [async.mapValues]{@link module:Collections.mapValues} * @category Collection * @param {Object} obj - A collection to iterate over. * @param {Function} iteratee - A function to apply to each value in `obj`. diff --git a/lib/memoize.js b/lib/memoize.js index 5b06cff..31c041c 100644 --- a/lib/memoize.js +++ b/lib/memoize.js @@ -24,7 +24,8 @@ function has(obj, key) { * * @name memoize * @static - * @memberOf async + * @memberOf module:Utils + * @method * @category Util * @param {Function} fn - The function to proxy and cache results from. * @param {Function} hasher - An optional function for generating a custom hash diff --git a/lib/nextTick.js b/lib/nextTick.js index 9a1d6a0..62d20de 100644 --- a/lib/nextTick.js +++ b/lib/nextTick.js @@ -12,7 +12,8 @@ import { hasNextTick, hasSetImmediate, fallback, wrap } from './internal/setImm * * @name nextTick * @static - * @memberOf async + * @memberOf module:Utils + * @method * @alias setImmediate * @category Util * @param {Function} callback - The function to call on a later loop around diff --git a/lib/parallel.js b/lib/parallel.js index 5a01b5f..1f6a3cc 100644 --- a/lib/parallel.js +++ b/lib/parallel.js @@ -21,7 +21,8 @@ import doLimit from './internal/doLimit'; * * @name parallel * @static - * @memberOf async + * @memberOf module:ControlFlow + * @method * @category Control Flow * @param {Array|Object} tasks - A collection containing functions to run. * Each function is passed a `callback(err, result)` which it must call on diff --git a/lib/parallelLimit.js b/lib/parallelLimit.js index 2eb8b2f..926fa85 100644 --- a/lib/parallelLimit.js +++ b/lib/parallelLimit.js @@ -2,13 +2,14 @@ import eachOfLimit from './internal/eachOfLimit'; import parallel from './internal/parallel'; /** - * The same as `parallel` but runs a maximum of `limit` async operations at a + * The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a * time. * - * @name parallel + * @name parallelLimit * @static - * @memberOf async - * @see async.parallel + * @memberOf module:ControlFlow + * @method + * @see [async.parallel]{@link module:ControlFlow.parallel} * @category Control Flow * @param {Array|Collection} tasks - A collection containing functions to run. * Each function is passed a `callback(err, result)` which it must call on diff --git a/lib/priorityQueue.js b/lib/priorityQueue.js index 36cacaf..9ea24bc 100644 --- a/lib/priorityQueue.js +++ b/lib/priorityQueue.js @@ -7,13 +7,14 @@ import setImmediate from './setImmediate'; import queue from './queue'; /** - * The same as {@link async.queue} only tasks are assigned a priority and + * The same as [async.queue]{@link module:ControlFlow.queue} only tasks are assigned a priority and * completed in ascending priority order. * * @name priorityQueue * @static - * @memberOf async - * @see async.queue + * @memberOf module:ControlFlow + * @method + * @see [async.queue]{@link module:ControlFlow.queue} * @category Control Flow * @param {Function} worker - An asynchronous function for processing a queued * task, which must call its `callback(err)` argument when finished, with an @@ -23,7 +24,7 @@ import queue from './queue'; * @param {number} concurrency - An `integer` for determining how many `worker` * functions should be run in parallel. If omitted, the concurrency defaults to * `1`. If the concurrency is `0`, an error is thrown. - * @returns {queue} A priorityQueue object to manage the tasks. There are two + * @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are two * differences between `queue` and `priorityQueue` objects: * * `push(task, priority, [callback])` - `priority` should be a number. If an * array of `tasks` is given, all tasks will be assigned the same priority. diff --git a/lib/queue.js b/lib/queue.js index ac1987a..109ba50 100644 --- a/lib/queue.js +++ b/lib/queue.js @@ -2,26 +2,27 @@ import queue from './internal/queue'; /** * A queue of tasks for the worker function to complete. - * @typedef {Object} queue + * @typedef {Object} QueueObject + * @memberOf module:ControlFlow * @property {Function} length - a function returning the number of items - * waiting to be processed. Invoke with (). + * waiting to be processed. Invoke with `queue.length()`. * @property {Function} started - a function returning whether or not any - * items have been pushed and processed by the queue. Invoke with (). + * items have been pushed and processed by the queue. Invoke with `queue.started()`. * @property {Function} running - a function returning the number of items - * currently being processed. Invoke with (). + * currently being processed. Invoke with `queue.running()`. * @property {Function} workersList - a function returning the array of items - * currently being processed. Invoke with (). + * currently being processed. Invoke with `queue.workersList()`. * @property {Function} idle - a function returning false if there are items - * waiting or being processed, or true if not. Invoke with (). + * waiting or being processed, or true if not. Invoke with `queue.idle()`. * @property {number} concurrency - an integer for determining how many `worker` * functions should be run in parallel. This property can be changed after a * `queue` is created to alter the concurrency on-the-fly. * @property {Function} push - add a new task to the `queue`. Calls `callback` * once the `worker` has finished processing the task. Instead of a single task, * a `tasks` array can be submitted. The respective callback is used for every - * task in the list. Invoke with (task, [callback]), + * task in the list. Invoke with `queue.push(task, [callback])`, * @property {Function} unshift - add a new task to the front of the `queue`. - * Invoke with (task, [callback]). + * Invoke with `queue.unshift(task, [callback])`. * @property {Function} saturated - a callback that is called when the number of * running workers hits the `concurrency` limit, and further tasks will be * queued. @@ -39,11 +40,11 @@ import queue from './internal/queue'; * @property {boolean} paused - a boolean for determining whether the queue is * in a paused state. * @property {Function} pause - a function that pauses the processing of tasks - * until `resume()` is called. Invoke with (). + * until `resume()` is called. Invoke with `queue.pause()`. * @property {Function} resume - a function that resumes the processing of - * queued tasks when the queue is paused. Invoke with (). + * queued tasks when the queue is paused. Invoke with `queue.length()`. * @property {Function} kill - a function that removes the `drain` callback and - * empties remaining tasks from the queue forcing it to go idle. Invoke with (). + * empties remaining tasks from the queue forcing it to go idle. Invoke with `queue.kill()`. */ /** @@ -54,7 +55,8 @@ import queue from './internal/queue'; * * @name queue * @static - * @memberOf async + * @memberOf module:ControlFlow + * @method * @category Control Flow * @param {Function} worker - An asynchronous function for processing a queued * task, which must call its `callback(err)` argument when finished, with an @@ -64,7 +66,7 @@ import queue from './internal/queue'; * @param {number} [concurrency=1] - An `integer` for determining how many * `worker` functions should be run in parallel. If omitted, the concurrency * defaults to `1`. If the concurrency is `0`, an error is thrown. - * @returns {queue} A queue object to manage the tasks. Callbacks can + * @returns {module:ControlFlow.QueueObject} A queue object to manage the tasks. Callbacks can * attached as certain properties to listen for specific events during the * lifecycle of the queue. * @example diff --git a/lib/race.js b/lib/race.js index 2b8ad39..893e860 100644 --- a/lib/race.js +++ b/lib/race.js @@ -11,7 +11,8 @@ import once from './internal/once'; * * @name race * @static - * @memberOf async + * @memberOf module:ControlFlow + * @method * @category Control Flow * @param {Array} tasks - An array containing functions to run. Each function * is passed a `callback(err, result)` which it must call on completion with an diff --git a/lib/reduce.js b/lib/reduce.js index 8f529a0..8145db7 100644 --- a/lib/reduce.js +++ b/lib/reduce.js @@ -13,7 +13,8 @@ import eachOfSeries from './eachOfSeries'; * * @name reduce * @static - * @memberOf async + * @memberOf module:Collections + * @method * @alias inject * @alias foldl * @category Collection diff --git a/lib/reduceRight.js b/lib/reduceRight.js index fda0505..69fd158 100644 --- a/lib/reduceRight.js +++ b/lib/reduceRight.js @@ -3,12 +3,13 @@ import reduce from './reduce'; var slice = Array.prototype.slice; /** - * Same as `reduce`, only operates on `coll` in reverse order. + * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `coll` in reverse order. * * @name reduceRight * @static - * @memberOf async - * @see async.reduce + * @memberOf module:Collections + * @method + * @see [async.reduce]{@link module:Collections.reduce} * @alias foldr * @category Collection * @param {Array|Object} coll - A collection to iterate over. diff --git a/lib/reflect.js b/lib/reflect.js index 63adefb..ac5345d 100644 --- a/lib/reflect.js +++ b/lib/reflect.js @@ -9,7 +9,8 @@ import rest from 'lodash/rest'; * * @name reflect * @static - * @memberOf async + * @memberOf module:Utils + * @method * @category Util * @param {Function} fn - The function you want to wrap * @returns {Function} - A function that always passes null to it's callback as diff --git a/lib/reflectAll.js b/lib/reflectAll.js index ac9ea06..4492d1d 100644 --- a/lib/reflectAll.js +++ b/lib/reflectAll.js @@ -1,12 +1,14 @@ import reflect from './reflect'; +import isArray from 'lodash/isArray'; /** - * A helper function that wraps an array of functions with reflect. + * A helper function that wraps an array or an object of functions with reflect. * * @name reflectAll * @static - * @memberOf async - * @see async.reflect + * @memberOf module:Utils + * @method + * @see [async.reflect]{@link module:Utils.reflect} * @category Util * @param {Array} tasks - The array of functions to wrap in `async.reflect`. * @returns {Array} Returns an array of functions, each function wrapped in @@ -38,7 +40,43 @@ import reflect from './reflect'; * // results[1].error = Error('bad stuff happened') * // results[2].value = 'two' * }); + * + * // an example using an object instead of an array + * let tasks = { + * one: function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * two: function(callback) { + * callback('two'); + * }, + * three: function(callback) { + * setTimeout(function() { + * callback(null, 'three'); + * }, 100); + * } + * }; + * + * async.parallel(async.reflectAll(tasks), + * // optional callback + * function(err, results) { + * // values + * // results.one.value = 'one' + * // results.two.error = 'two' + * // results.three.value = 'three' + * }); */ export default function reflectAll(tasks) { - return tasks.map(reflect); + var results; + if (isArray(tasks)) { + results = tasks.map(reflect); + } else { + var keys = Object.keys(tasks); + results = {}; + keys.forEach(function(key) { + results[key] = reflect.call(this, tasks[key]); + }); + } + return results; } diff --git a/lib/reject.js b/lib/reject.js index f4c7a45..f882a93 100644 --- a/lib/reject.js +++ b/lib/reject.js @@ -2,12 +2,13 @@ import rejectLimit from './rejectLimit'; import doLimit from './internal/doLimit'; /** - * The opposite of `filter`. Removes values that pass an `async` truth test. + * The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test. * * @name reject * @static - * @memberOf async - * @see async.filter + * @memberOf module:Collections + * @method + * @see [async.filter]{@link module:Collections.filter} * @category Collection * @param {Array|Object} coll - A collection to iterate over. * @param {Function} iteratee - A truth test to apply to each item in `coll`. diff --git a/lib/rejectLimit.js b/lib/rejectLimit.js index a8e2082..2a57bc7 100644 --- a/lib/rejectLimit.js +++ b/lib/rejectLimit.js @@ -2,13 +2,14 @@ import reject from './internal/reject'; import doParallelLimit from './internal/doParallelLimit'; /** - * The same as `reject` but runs a maximum of `limit` async operations at a + * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a * time. * * @name rejectLimit * @static - * @memberOf async - * @see async.reject + * @memberOf module:Collections + * @method + * @see [async.reject]{@link module:Collections.reject} * @category Collection * @param {Array|Object} coll - A collection to iterate over. * @param {number} limit - The maximum number of async operations at a time. diff --git a/lib/rejectSeries.js b/lib/rejectSeries.js index 8fc7a41..0844864 100644 --- a/lib/rejectSeries.js +++ b/lib/rejectSeries.js @@ -2,12 +2,13 @@ import rejectLimit from './rejectLimit'; import doLimit from './internal/doLimit'; /** - * The same as `reject` but runs only a single async operation at a time. + * The same as [`reject`]{@link module:Collections.reject} but runs only a single async operation at a time. * * @name rejectSeries * @static - * @memberOf async - * @see async.reject + * @memberOf module:Collections + * @method + * @see [async.reject]{@link module:Collections.reject} * @category Collection * @param {Array|Object} coll - A collection to iterate over. * @param {Function} iteratee - A truth test to apply to each item in `coll`. diff --git a/lib/retry.js b/lib/retry.js index 69c3eb3..5c22af3 100644 --- a/lib/retry.js +++ b/lib/retry.js @@ -10,7 +10,8 @@ import constant from 'lodash/constant'; * * @name retry * @static - * @memberOf async + * @memberOf module:ControlFlow + * @method * @category Control Flow * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - Can be either an * object with `times` and `interval` or a number. diff --git a/lib/retryable.js b/lib/retryable.js index b9c0fbb..00fd8f2 100644 --- a/lib/retryable.js +++ b/lib/retryable.js @@ -2,13 +2,14 @@ import retry from './retry'; import initialParams from './internal/initialParams'; /** - * A close relative of `retry`. This method wraps a task and makes it + * A close relative of [`retry`]{@link module:ControlFlow.retry}. This method wraps a task and makes it * retryable, rather than immediately calling it with retries. * * @name retryable * @static - * @memberOf async - * @see async.retry + * @memberOf module:ControlFlow + * @method + * @see [async.retry]{@link module:ControlFlow.retry} * @category Control Flow * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - optional * options, exactly the same as from `retry` @@ -5,14 +5,15 @@ import reduce from './reduce'; /** * Version of the compose function that is more natural to read. Each function * consumes the return value of the previous function. It is the equivalent of - * {@link async.compose} with the arguments reversed. + * [compose]{@link module:ControlFlow.compose} with the arguments reversed. * * Each function is executed with the `this` binding of the composed function. * * @name seq * @static - * @memberOf async - * @see async.compose + * @memberOf module:ControlFlow + * @method + * @see [async.compose]{@link module:ControlFlow.compose} * @category Control Flow * @param {...Function} functions - the asynchronous functions to compose * @returns {Function} a function that composes the `functions` in order diff --git a/lib/series.js b/lib/series.js index 3345519..1969943 100644 --- a/lib/series.js +++ b/lib/series.js @@ -24,7 +24,8 @@ import eachOfSeries from './eachOfSeries'; * * @name series * @static - * @memberOf async + * @memberOf module:ControlFlow + * @method * @category Control Flow * @param {Array|Object} tasks - A collection containing functions to run, each * function is passed a `callback(err, result)` it must call on completion with diff --git a/lib/setImmediate.js b/lib/setImmediate.js index 68f94d7..f820b46 100644 --- a/lib/setImmediate.js +++ b/lib/setImmediate.js @@ -10,7 +10,8 @@ import setImmediate from './internal/setImmediate'; * * @name setImmediate * @static - * @memberOf async + * @memberOf module:Utils + * @method * @alias nextTick * @category Util * @param {Function} callback - The function to call on a later loop around diff --git a/lib/some.js b/lib/some.js index 4f4e2b1..ff777e5 100644 --- a/lib/some.js +++ b/lib/some.js @@ -8,7 +8,8 @@ import doLimit from './internal/doLimit'; * * @name some * @static - * @memberOf async + * @memberOf module:Collections + * @method * @alias any * @category Collection * @param {Array|Object} coll - A collection to iterate over. diff --git a/lib/someLimit.js b/lib/someLimit.js index 50beb65..ad65721 100644 --- a/lib/someLimit.js +++ b/lib/someLimit.js @@ -3,12 +3,13 @@ import eachOfLimit from './eachOfLimit'; import identity from 'lodash/identity'; /** - * The same as `some` but runs a maximum of `limit` async operations at a time. + * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time. * * @name someLimit * @static - * @memberOf async - * @see async.some + * @memberOf module:Collections + * @method + * @see [async.some]{@link module:Collections.some} * @alias anyLimit * @category Collection * @param {Array|Object} coll - A collection to iterate over. diff --git a/lib/someSeries.js b/lib/someSeries.js index 18fd5ca..cc30c36 100644 --- a/lib/someSeries.js +++ b/lib/someSeries.js @@ -2,12 +2,13 @@ import someLimit from './someLimit'; import doLimit from './internal/doLimit'; /** - * The same as `some` but runs only a single async operation at a time. + * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time. * * @name someSeries * @static - * @memberOf async - * @see async.some + * @memberOf module:Collections + * @method + * @see [async.some]{@link module:Collections.some} * @alias anySeries * @category Collection * @param {Array|Object} coll - A collection to iterate over. diff --git a/lib/sortBy.js b/lib/sortBy.js index 539a829..ab6c420 100644 --- a/lib/sortBy.js +++ b/lib/sortBy.js @@ -9,7 +9,8 @@ import map from './map'; * * @name sortBy * @static - * @memberOf async + * @memberOf module:Collections + * @method * @category Collection * @param {Array|Object} coll - A collection to iterate over. * @param {Function} iteratee - A function to apply to each item in `coll`. diff --git a/lib/timeout.js b/lib/timeout.js index 1ce5378..7caba44 100644 --- a/lib/timeout.js +++ b/lib/timeout.js @@ -7,7 +7,8 @@ import initialParams from './internal/initialParams'; * * @name timeout * @static - * @memberOf async + * @memberOf module:Utils + * @method * @category Util * @param {Function} asyncFn - The asynchronous function you want to set the * time limit. diff --git a/lib/times.js b/lib/times.js index 1d5b6c3..bdd2e6b 100644 --- a/lib/times.js +++ b/lib/times.js @@ -3,17 +3,18 @@ import doLimit from './internal/doLimit'; /** * Calls the `iteratee` function `n` times, and accumulates results in the same - * manner you would use with {@link async.map}. + * manner you would use with [map]{@link module:Collections.map}. * * @name times * @static - * @memberOf async - * @see async.map + * @memberOf module:ControlFlow + * @method + * @see [async.map]{@link module:Collections.map} * @category Control Flow * @param {number} n - The number of times to run the function. * @param {Function} iteratee - The function to call `n` times. Invoked with the * iteration index and a callback (n, next). - * @param {Function} callback - see {@link async.map}. + * @param {Function} callback - see {@link module:Collections.map}. * @example * * // Pretend this is some complicated async factory diff --git a/lib/timesLimit.js b/lib/timesLimit.js index b4db62c..68d5ede 100644 --- a/lib/timesLimit.js +++ b/lib/timesLimit.js @@ -2,19 +2,20 @@ import mapLimit from './mapLimit'; import range from 'lodash/_baseRange'; /** -* The same as {@link times} but runs a maximum of `limit` async operations at a -* time. + * The same as [times]{@link module:ControlFlow.times} but runs a maximum of `limit` async operations at a + * time. * * @name timesLimit * @static - * @memberOf async - * @see async.times + * @memberOf module:ControlFlow + * @method + * @see [async.times]{@link module:ControlFlow.times} * @category Control Flow * @param {number} count - The number of times to run the function. * @param {number} limit - The maximum number of async operations at a time. * @param {Function} iteratee - The function to call `n` times. Invoked with the * iteration index and a callback (n, next). - * @param {Function} callback - see {@link async.map}. + * @param {Function} callback - see [async.map]{@link module:Collections.map}. */ export default function timeLimit(count, limit, iteratee, callback) { mapLimit(range(0, count, 1), limit, iteratee, callback); diff --git a/lib/timesSeries.js b/lib/timesSeries.js index 28a5434..672428d 100644 --- a/lib/timesSeries.js +++ b/lib/timesSeries.js @@ -2,16 +2,17 @@ import timesLimit from './timesLimit'; import doLimit from './internal/doLimit'; /** - * The same as {@link async.times} but runs only a single async operation at a time. + * The same as [times]{@link module:ControlFlow.times} but runs only a single async operation at a time. * * @name timesSeries * @static - * @memberOf async - * @see async.times + * @memberOf module:ControlFlow + * @method + * @see [async.times]{@link module:ControlFlow.times} * @category Control Flow * @param {number} n - The number of times to run the function. * @param {Function} iteratee - The function to call `n` times. Invoked with the * iteration index and a callback (n, next). - * @param {Function} callback - see {@link async.map}. + * @param {Function} callback - see {@link module:Collections.map}. */ export default doLimit(timesLimit, 1); diff --git a/lib/transform.js b/lib/transform.js index 55fd067..6098522 100644 --- a/lib/transform.js +++ b/lib/transform.js @@ -9,7 +9,8 @@ import eachOf from './eachOf'; * * @name transform * @static - * @memberOf async + * @memberOf module:Collections + * @method * @category Collection * @param {Array|Object} coll - A collection to iterate over. * @param {*} [accumulator] - The initial state of the transform. If omitted, diff --git a/lib/unmemoize.js b/lib/unmemoize.js index e7d9765..4b2db4d 100644 --- a/lib/unmemoize.js +++ b/lib/unmemoize.js @@ -1,11 +1,12 @@ /** - * Undoes a {@link async.memoize}d function, reverting it to the original, + * Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original, * unmemoized form. Handy for testing. * * @name unmemoize * @static - * @memberOf async - * @see async.memoize + * @memberOf module:Utils + * @method + * @see [async.memoize]{@link module:Utils.memoize} * @category Util * @param {Function} fn - the memoized function * @returns {Function} a function that calls the original unmemoized function diff --git a/lib/until.js b/lib/until.js index 910e049..7b0b0b5 100644 --- a/lib/until.js +++ b/lib/until.js @@ -5,12 +5,13 @@ import whilst from './whilst'; * stopped, or an error occurs. `callback` will be passed an error and any * arguments passed to the final `fn`'s callback. * - * The inverse of {@link async.whilst}. + * The inverse of [whilst]{@link module:ControlFlow.whilst}. * * @name until * @static - * @memberOf async - * @see async.whilst + * @memberOf module:ControlFlow + * @method + * @see [async.whilst]{@link module:ControlFlow.whilst} * @category Control Flow * @param {Function} test - synchronous truth test to perform before each * execution of `fn`. Invoked with (). diff --git a/lib/waterfall.js b/lib/waterfall.js index 9478bd9..b3f0dbc 100644 --- a/lib/waterfall.js +++ b/lib/waterfall.js @@ -13,7 +13,8 @@ import onlyOnce from './internal/onlyOnce'; * * @name waterfall * @static - * @memberOf async + * @memberOf module:ControlFlow + * @method * @category Control Flow * @param {Array} tasks - An array of functions to run, each function is passed * a `callback(err, result1, result2, ...)` it must call on completion. The diff --git a/lib/whilst.js b/lib/whilst.js index ee1c19a..3311f4c 100644 --- a/lib/whilst.js +++ b/lib/whilst.js @@ -7,7 +7,8 @@ import rest from 'lodash/rest'; * * @name whilst * @static - * @memberOf async + * @memberOf module:ControlFlow + * @method * @category Control Flow * @param {Function} test - synchronous truth test to perform before each * execution of `fn`. Invoked with (). |