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