This repository has been archived on 2023-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
|
export function chunkify<T>(arr: T[], chunkCount: number): T[][] {
|
|
const chunkSize = Math.round(arr.length / chunkCount);
|
|
const arrArr: T[][] = [];
|
|
|
|
for (let i = 0, j = arr.length; i < j; i += chunkSize) {
|
|
arrArr.push(arr.slice(i, i + chunkSize));
|
|
}
|
|
|
|
return arrArr;
|
|
}
|