(arr: T[], size: number)
| 26 | } |
| 27 | |
| 28 | export function chopInputArray<T>(arr: T[], size: number): Array<T[]> { |
| 29 | const res = []; |
| 30 | let startIndex = 0; |
| 31 | let endIndex = size - 1; |
| 32 | |
| 33 | while (startIndex < arr.length) { |
| 34 | const r = arr.slice(startIndex, endIndex + 1); |
| 35 | res.push(r); |
| 36 | startIndex += size; |
| 37 | endIndex += size; |
| 38 | } |
| 39 | return res; |
| 40 | } |