Maps an object's values to a new set of values using a transformation function.
The type of the result is an object preserving the keys and inferring the type of each value based on the transformation function.
const obj = { a: 1, b: 2, c: 3 };const double = (x: number) => x * 2;const a = mapObjectWith(obj)(double); // { a: 2, b: 4, c: 6 }// type { a: number, b: number, c: number } Copy
const obj = { a: 1, b: 2, c: 3 };const double = (x: number) => x * 2;const a = mapObjectWith(obj)(double); // { a: 2, b: 4, c: 6 }// type { a: number, b: number, c: number }
Maps an object's values to a new set of values using a transformation function.
The type of the result is an object preserving the keys and inferring the type of each value based on the transformation function.
Example