Maps the given object with the given function.

Type signature

(
  f: (value: any, key: string, context: object) => any
) => (xs: object) => object

Examples

map((x) => x ** 2)({
  a: 1,
  b: 2,
  c: 3,
});
// ⇒ { a: 1, b: 4, c: 9 }
Try in REPL

Questions

  • How to map an object?
  • How to transform an object?

TypeScript sourceJavaScript source