UI for Zipcoin Blue

eachLimit.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = eachLimit;
  6. var _eachOfLimit = require('./internal/eachOfLimit');
  7. var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
  8. var _withoutIndex = require('./internal/withoutIndex');
  9. var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
  10. var _wrapAsync = require('./internal/wrapAsync');
  11. var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
  12. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13. /**
  14. * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
  15. *
  16. * @name eachLimit
  17. * @static
  18. * @memberOf module:Collections
  19. * @method
  20. * @see [async.each]{@link module:Collections.each}
  21. * @alias forEachLimit
  22. * @category Collection
  23. * @param {Array|Iterable|Object} coll - A collection to iterate over.
  24. * @param {number} limit - The maximum number of async operations at a time.
  25. * @param {AsyncFunction} iteratee - An async function to apply to each item in
  26. * `coll`.
  27. * The array index is not passed to the iteratee.
  28. * If you need the index, use `eachOfLimit`.
  29. * Invoked with (item, callback).
  30. * @param {Function} [callback] - A callback which is called when all
  31. * `iteratee` functions have finished, or an error occurs. Invoked with (err).
  32. */
  33. function eachLimit(coll, limit, iteratee, callback) {
  34. (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);
  35. }
  36. module.exports = exports['default'];