Function mapWithIndex

  • Maps over an array with index.

    Type Parameters

    • T

    • U

    Parameters

    • f: ((x, i) => U)
        • (x, i): U
        • Parameters

          • x: T
          • i: number

          Returns U

    Returns ((x) => U[])

      • (x): U[]
      • Parameters

        • x: readonly T[]

        Returns U[]

    Example

    mapWithIndex((x, i) => x + i)(['a', 'b']) // ['a0', 'b1']
    

Generated using TypeDoc