requireNext()function
requireNext(items: PossibleArray<T>, item: T, caller: AnyCaller = requireNext): T
| Param | Type | |
|---|---|---|
items | PossibleArray<T> | The array or iterable to search. required |
item | T | The item to find the successor of. required |
caller | AnyCaller | Function to attribute a thrown error to (defaults to requireNext itself). Defaults to requireNext |
| Return | |
|---|---|
T | The item following item. |
| Throws | |
|---|---|
RequiredError | If item is missing or has no successor. |
Get the next item from an array or iterable.
Examples
requireNext([1, 2, 3], 2) // 3