The condition to decide to drop from the list.
The filtered list.
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
Drops while the element satisfies
pred
. If the element does not matchpred
, the rest of elements are yielded.