Roo-Code/evals/packages/lib/src/in-chunks-of.ts
Chris Estreich d15f813514
Evals (#2238)
* Evals

* Remove redundant line

* Fix tsc error

* Disable debug mode

* Add option to kill run
2025-04-02 16:49:41 -07:00

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
}