MCPcopy Index your code
hub / github.com/deployd/deployd / chunk

Function chunk

test-app/public/sinon.js:17466–17484  ·  view source on GitHub ↗

* Creates an array of elements split into groups the length of `size`. * If `array` can't be split evenly, the final chunk will be the remaining * elements. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Ar

(array, size, guard)

Source from the content-addressed store, hash-verified

17464 * // => [['a', 'b', 'c'], ['d']]
17465 */
17466 function chunk(array, size, guard) {
17467 if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
17468 size = 1;
17469 } else {
17470 size = nativeMax(toInteger(size), 0);
17471 }
17472 var length = array == null ? 0 : array.length;
17473 if (!length || size < 1) {
17474 return [];
17475 }
17476 var index = 0,
17477 resIndex = 0,
17478 result = Array(nativeCeil(length / size));
17479
17480 while (index < length) {
17481 result[resIndex++] = baseSlice(array, index, (index += size));
17482 }
17483 return result;
17484 }
17485
17486 /**
17487 * Creates an array with all falsey values removed. The values `false`, `null`,

Callers

nothing calls this directly

Calls 3

isIterateeCallFunction · 0.85
toIntegerFunction · 0.85
baseSliceFunction · 0.85

Tested by

no test coverage detected