Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 42x 45x 45x 45x 45x 1423x 1423x 235x 235x 235x 41x 2x 41x | export const chunkBySize = (chunkSize: number) => <T>(array: T[]): T[][] => {
const result = [];
let chunk = [];
let count = 0;
for (const t of array) {
chunk.push(t);
if (++count === chunkSize) {
count = 0;
result.push(chunk);
chunk = [];
}
}
if (count !== 0) {
result.push(chunk);
}
return result;
};
|