Transforms the object keys with the given function.

Type signature

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

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