mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-10 03:28:03 +00:00
* Evals * Remove redundant line * Fix tsc error * Disable debug mode * Add option to kill run
14 lines
310 B
TypeScript
14 lines
310 B
TypeScript
export function inChunksOf<T>(ary: T[], perChunk = 2) {
|
|
const result = ary.reduce((collect, item, index) => {
|
|
const chunkIndex = Math.floor(index / perChunk)
|
|
|
|
if (!collect[chunkIndex]) {
|
|
collect[chunkIndex] = []
|
|
}
|
|
|
|
collect[chunkIndex].push(item)
|
|
return collect
|
|
}, [] as T[][])
|
|
|
|
return result
|
|
}
|