mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
9 lines
219 B
TypeScript
9 lines
219 B
TypeScript
import concatMap from "concat-map";
|
|
|
|
const xs = [1, 2, 3, 4, 5, 6];
|
|
concatMap(xs, x => (x % 2 ? [x - 0.1, x, x + 0.1] : []));
|
|
// [0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1]
|
|
|
|
concatMap(xs, x => x % 2);
|
|
// [1, 0, 1, 0, 1, 0]
|