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

    Function filter

    • Creates a task filtering stream items based on a predicate.

      Items are processed sequentially and output order is preserved.

      Type Parameters

      • V

        The type of items in the stream

      Parameters

      • predicate: (item: V) => boolean | Promise<boolean | undefined> | undefined

        The function to test each item. When the predicate returns undefined, it is treated as false and the item is filtered out.

      Returns Task<V>

      A task that filters items based on the predicate

      Predicate Composition:

      Use predicate utilities from the @metreeca/core predicates module to create complex filtering criteria.

      await items([1, 2, 3, 4, 5])(filter(x => x % 2 === 0))(toArray());  // [2, 4]