yta
    Preparing search index...

    Function filter

    • Filter items in the iterator leaving only the items that fulfill the predicate.

      import { pipe } from "yta";
      import { filter, range, toArray } from "yta/sync";

      pipe(
      range(10),
      filter((n) => n % 2 === 0),
      toArray(),
      );
      // => [0, 2, 4, 6, 8]

      Type Parameters

      • A

        The item type

      Parameters

      • p: (item: A) => boolean

        The predicated function

      Returns (items: Iterable<A>) => Generator<A, void>