(items: T[], maxPerBatch: number, action: (items: T[]) => void)
| 202 | } |
| 203 | |
| 204 | function batch<T>(items: T[], maxPerBatch: number, action: (items: T[]) => void) { |
| 205 | for (let index = 0; index < items.length; index = index + maxPerBatch) { |
| 206 | const itemsSlice = items.slice(index, index + maxPerBatch); |
| 207 | action(itemsSlice); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | export default class API { |
| 212 | apiRoot: string; |