asyncMap<T, U>
Maps over an array asynchronously, applying the provided callback function to each element.
Import:
import { asyncMap } from '@mnaoumov/typescript-lib/async';Signature:
function asyncMap(array: T[], callback: (value: T, index: number, array: T[]) => Promisable<U>): Promise<U[]>Parameters:
| Parameter | Type | Description |
|---|---|---|
array |
T[] | The array to map over. |
callback |
(value: T, index: number, array: T[]) => Promisable<U> | The callback function to apply to each element. |
Returns: Promise<U[]> — A Promise that resolves with an array of the results of the callback function.