@mikuroxina/mini-fn
    Preparing search index...

    Function dropWhileEnd

    • Drops the largest suffix of the list in which pred holds for all elements of the suffix.

      Type Parameters

      • T

      Parameters

      • pred: (t: T) => boolean

        The condition to drop the suffix.

      Returns (list: List.List<T>) => List.List<T>

      The list dropped the matched suffix.

      Examples

      expect([
      ...toIterator(
      dropWhileEnd((x: number) => x < 3)(
      fromArray([1, 2, 3, 4, 5, 1, 2]),
      ),
      ),
      ]).toStrictEqual([1, 2, 3, 4, 5]);
      expect(
      toArray(dropWhileEnd((x: number) => x < 9)(fromArray([1, 2, 3]))),
      ).toStrictEqual(
      [],
      );
      expect(
      toArray(dropWhileEnd((x: number) => x < 0)(fromArray([1, 2, 3]))),
      ).toStrictEqual(
      [1, 2, 3],
      );