Prelude API
    Preparing search index...

    Function until

    • Creates a generator that yields values from the source iterable until the predicate returns true.

      Type Parameters

      • T

        The type of elements in the source iterable.

      Parameters

      • predicate: (value: T, index: number) => boolean

        Function that tests each element and its index, returning a boolean.

      Returns (values: Iterable<T>) => Generator<T>

      A generator function that takes an iterable and yields elements until the predicate returns true.

      Elements from the source iterable until the predicate returns true (exclusive).

      G.pipe(
      [1, 2, 3, 4, 5, 1, 2],
      G.until(x => x > 3),
      G.array
      ) // [1, 2, 3]