jussi-kalliokoski / trine

A utility library for modern JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Iterable] Flatten array proposal

ivoreis opened this issue · comments

I saw that there's no flatten generator and probably this might be useful and used by other generators.

Example usage:

[[1],[2]]::flatten() // yields [1,2]

Possible implementation in commit: 55f86dd

Could be made even more generic ala python's itertools.chain: take an iterable of iterables (arrays, generators...) and create an iterator yielding their items sequentially. The same basic idea, but a bit more. I see your commit does exactly that.

Duplicate of #8.