• Maps each element of a tuple individually using its own Mapper.

    Example

    const tuple = [1, "abc"];

    const mapper = mapTuple(
    (num) => num > 0,
    (str) => str.length,
    );

    const result = mapper(tuple);

    console.log(result); // [true, 3]

    Param Type

    TArgs - the type of the input tuple

    Param Type

    RArgs - the type of the mapped output tuple

    Returns

    the mapped tuple

    Type Parameters

    • TArgs extends unknown[]

    • RArgs extends { [ index in string | number | symbol]: unknown }

    Parameters

    • mappers: { [ index in string | number | symbol]: Mapper<TArgs[index], RArgs[index]> }

      the Mappers to use

    Returns ((tuple: TArgs) => RArgs)

      • (tuple: TArgs): RArgs
      • Parameters

        • tuple: TArgs

        Returns RArgs

Generated using TypeDoc