Creates an object with the same keys and values generated by running each own enumerable string keyed and symbol keyed property of object through the callback.
Info
The source object should be a Plain Object.
Info
The returned object preserves a null prototype when the source object was created with Object.create(null).
Syntax
TypeScript
import { mapValues } from "@opentf/std"; mapValues(obj: object, fn: (value: any, key: string | symbol) => any)
Warning
__proto__, constructor and prototype are skipped.
Examples
TypeScript
const obj = { a: 1, b: 2 }; mapValues(obj, (v) => v * 2); //=> { a: 2, b: 4 }