@eroyeroy/utils - v0.1.0
    Preparing search index...

    Function mapValues

    • Creates a new object by applying fn to each value of obj. Keys are preserved.

      Type Parameters

      • T extends object
      • V

      Parameters

      • obj: T

        The source object.

      • fn: (value: T[keyof T], key: keyof T) => V

        Mapping function receiving each value and key.

      Returns Record<keyof T, V>

      mapValues({ a: 1, b: 2 }, v => v * 2) // => { a: 2, b: 4 }