Creates a new object with the same keys as the input object, where each value is the result of applying the provided function to the original value.
The object whose values will be transformed.
A function that transforms each value of the object.
A new object with transformed values.
const obj = { a: 1, b: 2 };const doubled = mapValues(obj, (value) => value * 2);console.log(doubled); // { a: 2, b: 4 } Copy
const obj = { a: 1, b: 2 };const doubled = mapValues(obj, (value) => value * 2);console.log(doubled); // { a: 2, b: 4 }
1.1.0
Creates a new object with the same keys as the input object, where each value is the result of applying the provided function to the original value.