Returns a new array that drops all elements in the given collection until the first element that does not match the given predicate.
The type of the elements in the input array.
The array to drop elements from.
The function to test each element for a condition.
A new array that drops all elements until the first element that does not match the given predicate.
import { dropWhile } from "@std/collections/drop-while";import { assertEquals } from "@std/assert";const numbers = [3, 2, 5, 2, 5];const dropWhileNumbers = dropWhile(numbers, (number) => number !== 2);assertEquals(dropWhileNumbers, [2, 5, 2, 5]); Copy
import { dropWhile } from "@std/collections/drop-while";import { assertEquals } from "@std/assert";const numbers = [3, 2, 5, 2, 5];const dropWhileNumbers = dropWhile(numbers, (number) => number !== 2);assertEquals(dropWhileNumbers, [2, 5, 2, 5]);
Returns a new array that drops all elements in the given collection until the first element that does not match the given predicate.