MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / times

Function times

lib/web/jshint.js:12919–12939  ·  view source on GitHub ↗

* Invokes the iteratee function `n` times, returning an array of the results * of each invocation. The `iteratee` is bound to `thisArg` and invoked with * one argument; (index). * * @static * @memberOf _ * @category Utility * @param {number} n The number of times t

(n, iteratee, thisArg)

Source from the content-addressed store, hash-verified

12917 * // => also invokes `mage.castSpell(n)` three times
12918 */
12919 function times(n, iteratee, thisArg) {
12920 n = floor(n);
12921
12922 // Exit early to avoid a JSC JIT bug in Safari 8
12923 // where `Array(0)` is treated as `Array(1)`.
12924 if (n < 1 || !nativeIsFinite(n)) {
12925 return [];
12926 }
12927 var index = -1,
12928 result = Array(nativeMin(n, MAX_ARRAY_LENGTH));
12929
12930 iteratee = bindCallback(iteratee, thisArg, 1);
12931 while (++index < n) {
12932 if (index < MAX_ARRAY_LENGTH) {
12933 result[index] = iteratee(index);
12934 } else {
12935 iteratee(index);
12936 }
12937 }
12938 return result;
12939 }
12940
12941 /**
12942 * Generates a unique ID. If `prefix` is provided the ID is appended to it.

Callers

nothing calls this directly

Calls 1

bindCallbackFunction · 0.85

Tested by

no test coverage detected