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

    Module tasks

    Intermediate operations that transform, filter, or process stream items.

    Custom Tasks are functions that transform async iterables by returning async generator functions:

    import { items, toArray, type Task } from '@metreeca/pipe';

    function double<V extends number>(): Task<V, V> {
    return async function* (source) {
    for await (const item of source) { yield item * 2 as V; }
    };
    }

    await items([1, 2, 3])(double())(toArray()); // [2, 4, 6]

    Functions

    skip

    Creates a task skipping the first n items from the stream.

    take

    Creates a task taking only the first n items from the stream.

    peek

    Creates a task executing a side effect for each item without modifying the stream.

    filter

    Creates a task filtering stream items based on a predicate.

    distinct

    Creates a task filtering out duplicate items.

    map

    Creates a task that maps each input item to an output value using a mapper function.

    flatMap

    Creates a task that transforms each item into a data source and flattens the results.

    batch

    Creates a task grouping items into batches of a specified size.