requireNext()function

requireNext(items: PossibleArray<T>, item: T, caller: AnyCaller = requireNext): T
ParamType
itemsPossibleArray<T>
The array or iterable to search. required
itemT
The item to find the successor of. required
callerAnyCaller
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