yta
    Preparing search index...

    Function every

    • Consumes the iterator into true if predicate holds true for every item in the sequence.

      import { pipe } from "yta";
      import { every, of } from "yta/sync";

      pipe(
      of(2, 4, 6),
      every((n) => n % 2 === 0),
      );
      // => true

      pipe(
      of("foo", "bar", "baz"),
      every((str) => str.startsWith("b")),
      );
      // => false

      pipe(
      of(),
      every(() => false),
      );
      // => true

      See also:

      Type Parameters

      • A

      Parameters

      • p: (item: A) => boolean

        The predicate function

      Returns (items: Iterable<A>) => boolean