times.js 315 B

1234567891011121314
  1. define(['./_optimizeCb'], function (_optimizeCb) {
  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. return times;
  10. });