@mirei/ts-collections
    Preparing search index...

    Function skipWhile

    • Skips elements while a predicate returns true and then yields the remaining elements.

      Type Parameters

      • TElement

        Type of elements within the source iterable.

      Parameters

      • source: Iterable<TElement>

        The source iterable.

      • predicate: IndexedPredicate<TElement>

        Predicate receiving the element and its zero-based index. The first element for which it returns false is included in the result.

      Returns IEnumerable<TElement>

      A deferred sequence starting with the first element that fails predicate.

      The predicate's index parameter increments only while elements are being skipped.

      const numbers = [1, 2, 3, 4, 5, 1, 2];
      const skipped = skipWhile(numbers, x => x < 4).toArray();
      console.log(skipped); // [4, 5, 1, 2]