dropRightWhile
Import from @varavel/vdl-plugin-sdk/utils/arrays.
Removes elements from the end of an array until the predicate returns false.
This function iterates over an array from the end and drops elements until the provided predicate function returns false. It then returns a new array with the remaining elements.
Type Parameters
| Type Parameter | Description |
|---|---|
T |
The type of elements in the array. |
Parameters
| Parameter | Type | Description |
|---|---|---|
arr |
readonly T[] |
The array from which to drop elements. |
canContinueDropping |
(item, index, arr) => boolean |
A predicate function that determines whether to continue dropping elements. The function is called with each element from the end, and dropping continues as long as it returns true. |
Returns
T[]
A new array with the elements remaining after the predicate returns false.