times.js 285 B

123456789
  1. import optimizeCb from './_optimizeCb.js';
  2. // Run a function **n** times.
  3. export default 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. }