@metreeca/flow - v0.9.21
    Preparing search index...

    Type Alias Data<V>

    Data:
        | readonly (undefined | V)[]
        | Iterable<undefined | V>
        | AsyncIterable<undefined | V>
        | Feed<V>

    Data accepted wherever a feed is opened or extended.

    Callers supply data in whichever shape is most convenient, each contributing items to the feed as follows:

    • readonly V[] — contributes the items of the array
    • Iterable<V> — contributes the items of the iterable, strings excepted, as they are treated as atomic values and contributed whole rather than character by character
    • AsyncIterable<V> — contributes the items of the async iterable
    • Feed<V> — contributes the items of the feed

    Every shape is a batch of items rather than a single value: a lone value is contributed by wrapping it in an array and an empty batch contributes nothing. Feeds of arrays stay expressible, as readonly V[] always denotes the batch rather than one of the values carried by it.

    Optional values need not be filtered out beforehand: every shape accepts undefined entries and drops them as data enters a feed, so a source of undefined | V values opens a feed carrying V items.

    The feed function opens a new feed from this shape; flatMap accepts it to expand each item already carried into further ones.

    Type Parameters

    • V

      The type of values contributed to the feed

    const array: Data<number> = [1, 2, 3];
    const iterable: Data<number> = new Set([1, 2, 3]);
    const asynchronous: Data<number> = (async function* () { yield 1; yield 2; })();
    const feed: Data<number> = items(1, 2, 3);

    items to contribute values as they are, without shape inspection