artdaq_node_server  v1_00_09
 All Classes Namespaces Files Variables Pages
times.js
1 var baseTimes = require('./_baseTimes'),
2  castFunction = require('./_castFunction'),
3  toInteger = require('./toInteger');
4 
6 var MAX_SAFE_INTEGER = 9007199254740991;
7 
9 var MAX_ARRAY_LENGTH = 4294967295;
10 
11 /* Built-in method references for those with the same name as other `lodash` methods. */
12 var nativeMin = Math.min;
13 
33 function times(n, iteratee) {
34  n = toInteger(n);
35  if (n < 1 || n > MAX_SAFE_INTEGER) {
36  return [];
37  }
38  var index = MAX_ARRAY_LENGTH,
39  length = nativeMin(n, MAX_ARRAY_LENGTH);
40 
41  iteratee = castFunction(iteratee);
42  n -= MAX_ARRAY_LENGTH;
43 
44  var result = baseTimes(length, iteratee);
45  while (++index < n) {
46  iteratee(index);
47  }
48  return result;
49 }
50 
51 module.exports = times;