Maps entries of the given object.

Type signature

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

Examples

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

Questions

  • How to map object entries?

TypeScript sourceJavaScript source