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

    Type Parameters

    • T

    Parameters

    • pred: ((t) => boolean)

      The condition to drop the suffix.

        • (t): boolean
        • Parameters

          • t: T

          Returns boolean

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

    The list dropped the matched suffix.

    Examples

    import { dropWhileEnd, fromArray, toArray, toIterator } from "./list.ts";
    import { assertEquals } from "../deps.ts";

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

Generated using TypeDoc