mirror of
https://github.com/ajnart/homarr.git
synced 2026-01-30 11:19:12 +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;
|
||
|
|
};
|