Maps the given object with the given function.

Type signature

<T, TResult>(f: (value: T, key: string, context: object) => TResult) => (xs: GenericObject<T>) => GenericObject<TResult>

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