getPrev()function
getPrev(items: PossibleArray<T>, value: T): T | undefined
| Param | Type | |
|---|---|---|
items | PossibleArray<T> | The array or iterable to search. required |
value | T | The item to find the predecessor of. required |
| Return | |
|---|---|
T | undefined | The item preceding value, or undefined if value is missing or first. |
Get the previous item in an array or iterable.
Examples
getPrev([1, 2, 3], 2) // 1