Iterates through object properties returning object with same properties but modified values. Optionally some properties may be filtered out on returned object.
mapValues({ a: 1, b: 2 }, x => x * 2) // will return { a: 2, b: 4 } Copy
mapValues({ a: 1, b: 2 }, x => x * 2) // will return { a: 2, b: 4 }
mapValues({ a: 1, b: 2 }, () => mapValuesUNSET) // will return {} Copy
mapValues({ a: 1, b: 2 }, () => mapValuesUNSET) // will return {}
mapValues({ a: 1, b: 2 }, (value, key) => key === "b" ? mapValuesUNSET : value * 5) // will return { a: 5 } Copy
mapValues({ a: 1, b: 2 }, (value, key) => key === "b" ? mapValuesUNSET : value * 5) // will return { a: 5 }
source object
map function callback that will return new value of a property
Iterates through object properties returning object with same properties but modified values. Optionally some properties may be filtered out on returned object.
Example
Example
Example