UNPKG

pragmatic-fp-ts

Version:

Opinionated functional programming library with easy use in mind

10 lines (8 loc) 302 B
import { flatten } from "../main.ts"; describe("flatten", () => { it("flattens arrays", () => { const nestedArray = [1, 2, [3, 4], 5, [6, 7, 8], [9, 10, 11, 12]]; const expected = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; expect(flatten<number>(nestedArray)).toEqual(expected); }); });