Skip to content

Function: generator()

generator<T>(…items): Generator<T>

Flattens a mix of single items and iterables into one lazy Generator.

Arguments are emitted in order: null/undefined are skipped, non-string iterables (per isContainer) are yielded element-by-element, and anything else (including strings) is yielded as a single item.

T

Element type produced by the generator.

…readonly (T | Iterable<T, any, any> | null | undefined)[]

Items and/or iterables to flatten, in order.

Generator<T>

A generator over the flattened elements.