• Drops while the element satisfies pred. If the element does not match pred, the rest of elements are yielded.

    Type Parameters

    • T

    Parameters

    • pred: ((t) => boolean)

      The condition to decide to drop from the list.

        • (t): boolean
        • Parameters

          • t: T

          Returns boolean

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

    The filtered list.

    Examples

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

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

Generated using TypeDoc