123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import baseTimes from './_baseTimes.js';
- import castFunction from './_castFunction.js';
- import toInteger from './toInteger.js';
- var MAX_SAFE_INTEGER = 9007199254740991;
- var MAX_ARRAY_LENGTH = 4294967295;
- var nativeMin = Math.min;
- function times(n, iteratee) {
- n = toInteger(n);
- if (n < 1 || n > MAX_SAFE_INTEGER) {
- return [];
- }
- var index = MAX_ARRAY_LENGTH,
- length = nativeMin(n, MAX_ARRAY_LENGTH);
- iteratee = castFunction(iteratee);
- n -= MAX_ARRAY_LENGTH;
- var result = baseTimes(length, iteratee);
- while (++index < n) {
- iteratee(index);
- }
- return result;
- }
- export default times;
|