Skip to content
This repository was archived by the owner on Aug 17, 2026. It is now read-only.

Latest commit

 

History

History
25 lines (18 loc) · 498 Bytes

File metadata and controls

25 lines (18 loc) · 498 Bytes

flatMap

Maps and flattens the result.

Type signature

<T, TResult>(f: (value: T, index: number, context: T[]) => TResult[]) => (xs: T[]) => TResult[]

Examples

flatMap(text => [...text])(["test", "123"]);
// ⇒ ["t", "e", "s", "t", "1", "2", "3"]

Questions

  • How to flat map an array?
  • How to map and then flatten an array?