• Internal

    Creates a new generator that flattens the input iterable. Flattening means that the generator yields elements of the inner iterables, one level deep.

    Type Parameters

    • T

      The element type of the elements of iterables in the input iterable

    Parameters

    • iterable: Iterable<Iterable<T>>

      The input iterable

    Returns Generator<T, void, undefined>

    A new generator with elements from the iterables in the input iterable

    Example

    const input = [[1, 2], [3, 4], [5, 6]];
    const result = [...flatten(input)];

    console.log(result); // [1, 2, 3, 4, 5, 6]

Generated using TypeDoc