function dropWhile
dropWhile<T>(array: readonly T[],predicate: (el: T) => boolean): T[]Returns a new array that drops all elements in the given collection until the first element that does not match the given predicate.
Examples
Example 1
Example 1
import { dropWhile } from "@std/collections/drop_while"; import { assertEquals } from "@std/assert/assert_equals"; const numbers = [3, 2, 5, 2, 5]; const dropWhileNumbers = dropWhile(numbers, (i) => i !== 2); assertEquals(dropWhileNumbers, [2, 5, 2, 5]);
Type Parameters
TParameters
Return Type
T[]