Flat maps the values of the given object.

Type signature

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

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