@unction/flatten
v10.13.0
Published
Takes a multi-dimensional functor and decreases the nesting by one
Downloads
39
Readme
@unction/flatten
ListType<Array | Set | Record<string | number | symbol, B> | Map<B, A> | string | A> | RecordType<unknown, Array | Set | Record<string | number | symbol, B> | Map<B, A> | string | A> | string => Array | Set | Record<string | number | symbol, B> | Map<B, A> | string
Takes a multi-dimensional enumerable and decreases the nesting by one.
import {from} from "most"
flatten([["a", "b"], ["c", "d"]]) // ["a", "b", "c", "d"]
flatten(["a", "b", ["c", "d"]]) // ["a", "b", "c", "d"]
flatten(
from([
from(["a", "b"]),
from(["c", "d"]),
])
) // ---a---b---c---d---|