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

    Function every

    • Creates a sink reporting whether every item matches a predicate.

      Items are tested in source order and consumption stops at the first mismatch, leaving the rest of the feed unconsumed; an empty feed reports a match, as no item contradicts the predicate.

      Note

      • Incremental: items are drawn only until one fails the predicate, so an infinite feed completes unless every item matches.
      • Streaming: items are tested one at a time, none retained.
      • Stateless: every item is tested on its own.

      Type Parameters

      • V

        The type of items in the feed

      Parameters

      • predicate: (item: NoInfer<V>) => Awaitable<boolean>

        The function testing each item

      Returns Sink<V, boolean>

      A sink resolving to true if every item matches predicate; false otherwise

      await pipe(
      (items([2, 4, 6, 8]))
      (every(n => n%2 === 0))
      ); // true