forked from caolan/async
-
Notifications
You must be signed in to change notification settings - Fork 0
/
groupBySeries.js
23 lines (22 loc) · 1.04 KB
/
groupBySeries.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import doLimit from './internal/doLimit';
import groupByLimit from './groupByLimit';
/**
* The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation at a time.
*
* @name groupBySeries
* @static
* @memberOf module:Collections
* @method
* @see [async.groupBy]{@link module:Collections.groupBy}
* @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, key)` which must be called once it
* has completed with an error (which can be `null`) and the `key` to group the
* value under. Invoked with (value, callback).
* @param {Function} [callback] - A callback which is called when all `iteratee`
* functions have finished, or an error occurs. Result is an `Object` whoses
* properties are arrays of values which returned the corresponding key.
*/
export default doLimit(groupByLimit, 1);