umami/lib/array.js
2020-09-13 01:26:54 -07:00

12 lines
197 B
JavaScript

export function chunk(arr, size) {
const chunks = [];
let index = 0;
while (index < arr.length) {
chunks.push(arr.slice(index, size + index));
index += size;
}
return chunks;
}