Function mapAsync

  • Map an array in parallel using an async mapping function.

    Returns

    a promise of the mapped array. it will resolve when all of the elements resolve

    Example

    await mapAsync([1, 2, 3], x => Promise.resolve(x + 1)) === [2, 3, 4]
    

    Type Parameters

    • TFrom

    • TTo

    Parameters

    • array: TFrom[]

      the array to filter

    • asyncMapFn: ((value, i, arr) => Promise<TTo>)

      the mapping function as an async function

        • (value, i, arr): Promise<TTo>
        • Parameters

          • value: TFrom
          • i: number
          • arr: TFrom[]

          Returns Promise<TTo>

    Returns Promise<TTo[]>

Generated using TypeDoc