Flat maps the values of the given object.

Type signature

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

Examples

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

Questions

  • How to flat map an object?

TypeScript sourceJavaScript source