UNPKG

pragmatic-fp-ts

Version:

Opinionated functional programming library with easy use in mind

11 lines (10 loc) 352 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.flatten = void 0; const main_1 = require("./main"); function flatten(coll) { const flat = []; (0, main_1.getValueOr)([], coll).forEach((el) => Array.isArray(el) ? el.forEach((x) => flat.push(x)) : flat.push(el)); return flat; } exports.flatten = flatten;