Returns a new object with the same keys as the input object, but with the values mapped using the provided function.

mapObjectValues({ a: 1, b: 2 }, value => value * 2) // { a: 2, b: 4 }
  • Type Parameters

    • T
    • U

    Parameters

    • obj: Record<string, T>

      The input object to map.

    • mapper: ((value: T) => U)

      A function that maps the values of the object.

        • (value): U
        • Parameters

          • value: T

          Returns U

    Returns Record<string, U>

    A new object with the mapped values.