take()
function take<T>(collection, batchSize): Iterable<T[]>
Given an iterable, returns an array of arrays of the specified size.
This is useful for batching asynchronous operations.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
collection | Iterable<T, any, any> | The collection to batch. |
batchSize | number | The size of each batch. |
Returns
Iterable<T[]>
An iterable of arrays of the specified size.