Returns a new array that drops all elements in the given collection until the last 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 last element that does not match the given predicate.
import { dropLastWhile } from "@std/collections/drop-last-while";import { assertEquals } from "@std/assert";const numbers = [11, 42, 55, 20, 33, 44];const notFortyFour = dropLastWhile(numbers, (number) => number > 30);assertEquals(notFortyFour, [11, 42, 55, 20]); Copy
import { dropLastWhile } from "@std/collections/drop-last-while";import { assertEquals } from "@std/assert";const numbers = [11, 42, 55, 20, 33, 44];const notFortyFour = dropLastWhile(numbers, (number) => number > 30);assertEquals(notFortyFour, [11, 42, 55, 20]);
Returns a new array that drops all elements in the given collection until the last element that does not match the given predicate.