• Creates an object with the same keys as the provided object and values generated by running the provided function for each value

    Example

    const users = {
    fred: { user: "fred", age: 40 },
    pebbles: { user: "pebbles", age: 1 }
    };
    mapValues(users, u => u.age); // { fred: 40, pebbles: 1 }

    Type Parameters

    • T extends Record<string, unknown>

    • K extends string | number | symbol

    Parameters

    • obj: T
    • fn: ((value: T[K], key: K, object: T) => unknown)
        • (value: T[K], key: K, object: T): unknown
        • Parameters

          • value: T[K]
          • key: K
          • object: T

          Returns unknown

    Returns Record<string, unknown>

Generated using TypeDoc