UNPKG

1.33 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = groupBySeries;
7
8var _groupByLimit = require('./groupByLimit');
9
10var _groupByLimit2 = _interopRequireDefault(_groupByLimit);
11
12function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14/**
15 * The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation at a time.
16 *
17 * @name groupBySeries
18 * @static
19 * @memberOf module:Collections
20 * @method
21 * @see [async.groupBy]{@link module:Collections.groupBy}
22 * @category Collection
23 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
24 * @param {AsyncFunction} iteratee - An async function to apply to each item in
25 * `coll`.
26 * The iteratee should complete with a `key` to group the value under.
27 * Invoked with (value, callback).
28 * @param {Function} [callback] - A callback which is called when all `iteratee`
29 * functions have finished, or an error occurs. Result is an `Object` whoses
30 * properties are arrays of values which returned the corresponding key.
31 * @returns {Promise} a promise, if no callback is passed
32 */
33function groupBySeries(coll, iteratee, callback) {
34 return (0, _groupByLimit2.default)(coll, 1, iteratee, callback);
35}
36module.exports = exports['default'];
\No newline at end of file