dropWhile es-toolkit
Returns a new array with elements removed from the beginning while a condition is satisfied.
Usage
dropWhile(arr, canContinueDropping)
Use dropWhile when you want to remove elements from the beginning of an array that meet a specific condition. Starting from the beginning of the array, it removes elements while the condition function returns true, and stops when it returns false.
If the array is empty or no elements satisfy the condition, it returns a new array same as the original.
Parameters
The array to remove elements from.
The condition function that determines whether to continue removing elements. It receives each element, its index, and the entire array, and returns true or false.
Returns
A new array containing elements from the first element that doesn't satisfy the condition to the end of the array.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.