eachOfLimit.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = eachOfLimit;
  6. var _eachOfLimit2 = require('./internal/eachOfLimit');
  7. var _eachOfLimit3 = _interopRequireDefault(_eachOfLimit2);
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9. /**
  10. * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a
  11. * time.
  12. *
  13. * @name eachOfLimit
  14. * @static
  15. * @memberOf module:Collections
  16. * @method
  17. * @see [async.eachOf]{@link module:Collections.eachOf}
  18. * @alias forEachOfLimit
  19. * @category Collection
  20. * @param {Array|Iterable|Object} coll - A collection to iterate over.
  21. * @param {number} limit - The maximum number of async operations at a time.
  22. * @param {Function} iteratee - A function to apply to each
  23. * item in `coll`. The `key` is the item's key, or index in the case of an
  24. * array. The iteratee is passed a `callback(err)` which must be called once it
  25. * has completed. If no error has occurred, the callback should be run without
  26. * arguments or with an explicit `null` argument. Invoked with
  27. * (item, key, callback).
  28. * @param {Function} [callback] - A callback which is called when all
  29. * `iteratee` functions have finished, or an error occurs. Invoked with (err).
  30. */
  31. function eachOfLimit(coll, limit, iteratee, callback) {
  32. (0, _eachOfLimit3.default)(limit)(coll, iteratee, callback);
  33. }
  34. module.exports = exports['default'];