groupBySeries.js 1.3 KB

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