Migrate to a monorepo structure (#2909)
This commit is contained in:
11
packages/twenty-front/src/utils/array/array-to-chunks.ts
Normal file
11
packages/twenty-front/src/utils/array/array-to-chunks.ts
Normal file
@ -0,0 +1,11 @@
|
||||
// split an array into subarrays of a given size
|
||||
export const arrayToChunks = <T>(array: T[], size: number) => {
|
||||
const arrayCopy = [...array];
|
||||
const results = [];
|
||||
|
||||
while (arrayCopy.length) {
|
||||
results.push(arrayCopy.splice(0, size));
|
||||
}
|
||||
|
||||
return results;
|
||||
};
|
||||
Reference in New Issue
Block a user