Asynchronously maps an array in batches and concatenates results.
Input element type.
Output element type.
The array to map.
Items per batch (0 = entire array as one batch).
0
Async mapper (batch, startIndex) => Promise<U[] | null | undefined>.
(batch, startIndex) => Promise<U[] | null | undefined>
Flattened array of all mapped items.
If batch_size is negative or not a safe integer.
batch_size
await batchedMap([1, 2, 3], 2, async (b) => b.map((x) => x * 2)); // [2, 4, 6] Copy
await batchedMap([1, 2, 3], 2, async (b) => b.map((x) => x * 2)); // [2, 4, 6]
Asynchronously maps an array in batches and concatenates results.