times.js 300 B

1234567891011
  1. var _optimizeCb = require('./_optimizeCb.js');
  2. // Run a function **n** times.
  3. function times(n, iteratee, context) {
  4. var accum = Array(Math.max(0, n));
  5. iteratee = _optimizeCb(iteratee, context, 1);
  6. for (var i = 0; i < n; i++) accum[i] = iteratee(i);
  7. return accum;
  8. }
  9. module.exports = times;