Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

parallelLimit.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = parallelLimit;
  6. var _eachOfLimit = require('./internal/eachOfLimit');
  7. var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
  8. var _parallel = require('./internal/parallel');
  9. var _parallel2 = _interopRequireDefault(_parallel);
  10. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11. /**
  12. * The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a
  13. * time.
  14. *
  15. * @name parallelLimit
  16. * @static
  17. * @memberOf module:ControlFlow
  18. * @method
  19. * @see [async.parallel]{@link module:ControlFlow.parallel}
  20. * @category Control Flow
  21. * @param {Array|Iterable|Object} tasks - A collection of
  22. * [async functions]{@link AsyncFunction} to run.
  23. * Each async function can complete with any number of optional `result` values.
  24. * @param {number} limit - The maximum number of async operations at a time.
  25. * @param {Function} [callback] - An optional callback to run once all the
  26. * functions have completed successfully. This function gets a results array
  27. * (or object) containing all the result arguments passed to the task callbacks.
  28. * Invoked with (err, results).
  29. */
  30. function parallelLimit(tasks, limit, callback) {
  31. (0, _parallel2.default)((0, _eachOfLimit2.default)(limit), tasks, callback);
  32. }
  33. module.exports = exports['default'];