mirror of
https://github.com/ajnart/homarr.git
synced 2026-01-30 19:29:17 +01:00
8 lines
226 B
TypeScript
8 lines
226 B
TypeScript
export const splitToNChunks = <T>(array: T[], chunks: number): T[][] => {
|
|
const result: T[][] = [];
|
|
for (let i = chunks; i > 0; i--) {
|
|
result.push(array.splice(0, Math.ceil(array.length / i)));
|
|
}
|
|
return result;
|
|
};
|