| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.default = groupBySeries;
|
|---|
| 7 |
|
|---|
| 8 | var _groupByLimit = require('./groupByLimit.js');
|
|---|
| 9 |
|
|---|
| 10 | var _groupByLimit2 = _interopRequireDefault(_groupByLimit);
|
|---|
| 11 |
|
|---|
| 12 | function _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` whose
|
|---|
| 30 | * properties are arrays of values which returned the corresponding key.
|
|---|
| 31 | * @returns {Promise} a promise, if no callback is passed
|
|---|
| 32 | */
|
|---|
| 33 | function groupBySeries(coll, iteratee, callback) {
|
|---|
| 34 | return (0, _groupByLimit2.default)(coll, 1, iteratee, callback);
|
|---|
| 35 | }
|
|---|
| 36 | module.exports = exports.default; |
|---|