@metreeca/pipe - v0.9.11
    Preparing search index...

    Type Alias Data<V>

    Data: V | readonly V[] | Iterable<V> | AsyncIterable<V> | Pipe<V>

    Flexible data source for stream processing.

    Represents various data formats that can be converted into async streams:

    • undefined - filtered out and not yielded
    • Single value: V - yields one item
    • Array: readonly V[] - yields items from the array
    • Synchronous iterable: Iterable<V> - yields items from the iterable
    • Asynchronous iterable: AsyncIterable<V> - yields items from the async iterable
    • Pipe: Pipe<V> - yields items from the pipe's underlying async iterable

    Type Parameters

    • V

      The type of values in the data source

    Enables functions to accept data in the most convenient format for the caller, internally normalizing it to async iterables for uniform processing. Used by items() to create pipes and by flatMap() to flatten nested data sources.

    undefined Handling: undefined values are automatically filtered out by the items() function, allowing tasks like map() to return undefined as a way to filter items from the stream.

    // All of these are valid Data<number> values:
    const scalarData: Data<number> = 42;
    const arrayData: Data<number> = [1, 2, 3];
    const iterableData: Data<number> = new Set([1, 2, 3]);
    const asyncData: Data<number> = (async function*() { yield 1; yield 2; })();
    const pipeData: Data<number> = items([1, 2, 3]);