• Iterates through object properties returning object with same properties but modified values. Optionally some properties may be filtered out on returned object.

    Example

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

    Example

    mapValues({ a: 1, b: 2 }, () => REMOVE) // will return {}
    

    Returns

    Type Parameters

    • SourceObject extends object

    • PossibleReturnValues

    Parameters

    • source: SourceObject

      source object

    • fn: MapValuesFn<SourceObject, PossibleReturnValues>

      map function callback that will return new value of a property

    Returns { [ P in string | number | symbol]: PossibleReturnValues }

Generated using TypeDoc