Transforms the object keys with the given function.

Type signature

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

Examples

mapKeys((_, key) =>
  key.toUpperCase()
)({ a: 1, b: 2, c: 3 });
// ⇒ { A: 1, B: 2, C: 3 }
Try in REPL

Questions

  • How to map object keys?
  • How to transform object keys?

TypeScript sourceJavaScript source