Returns an array of arrays, where each subarray contains a maximum of chunkSize elements from the input source array.
chunkSize
source
If chunkSize is less than or equal to 0, the entire source array is returned as a single chunk.
Chunkify
const a = [1, 2, 3, 4, 5, 6, 7, 8];const b = chunkify(3)(a);console.log(b); // [[1, 2, 3], [4, 5, 6], [7, 8]] Copy
const a = [1, 2, 3, 4, 5, 6, 7, 8];const b = chunkify(3)(a);console.log(b); // [[1, 2, 3], [4, 5, 6], [7, 8]]
Returns an array of arrays, where each subarray contains a maximum of
chunkSize
elements from the inputsource
array.If
chunkSize
is less than or equal to 0, the entiresource
array is returned as a single chunk.See
Chunkify
Example