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.

times.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _timesLimit = require('./timesLimit');
  6. var _timesLimit2 = _interopRequireDefault(_timesLimit);
  7. var _doLimit = require('./internal/doLimit');
  8. var _doLimit2 = _interopRequireDefault(_doLimit);
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. /**
  11. * Calls the `iteratee` function `n` times, and accumulates results in the same
  12. * manner you would use with [map]{@link module:Collections.map}.
  13. *
  14. * @name times
  15. * @static
  16. * @memberOf module:ControlFlow
  17. * @method
  18. * @see [async.map]{@link module:Collections.map}
  19. * @category Control Flow
  20. * @param {number} n - The number of times to run the function.
  21. * @param {AsyncFunction} iteratee - The async function to call `n` times.
  22. * Invoked with the iteration index and a callback: (n, next).
  23. * @param {Function} callback - see {@link module:Collections.map}.
  24. * @example
  25. *
  26. * // Pretend this is some complicated async factory
  27. * var createUser = function(id, callback) {
  28. * callback(null, {
  29. * id: 'user' + id
  30. * });
  31. * };
  32. *
  33. * // generate 5 users
  34. * async.times(5, function(n, next) {
  35. * createUser(n, function(err, user) {
  36. * next(err, user);
  37. * });
  38. * }, function(err, users) {
  39. * // we should now have 5 users
  40. * });
  41. */
  42. exports.default = (0, _doLimit2.default)(_timesLimit2.default, Infinity);
  43. module.exports = exports['default'];