Function objectMap

  • Execute a function on each property of an object and return the result as a new object This allows in place modification of the object. To create a new object, set inPlace to false, or use objectMap2 to modify the keys as well Similar to Array.map but for objects.

    Type Parameters

    • T extends string | number | symbol
    • V

    Parameters

    • obj: Record<T, V>

      object

    • fn: (val: V, key: T) => V

      function to execute on each property

    • inPlace: boolean = true

      if true, the original object is modified. Default is true

    Returns Record<T, V>