- Preparing search index...
- The search index is not available
itr8
- peek<TIn>(peekForward?: number, peekBackward?: number): TTransIteratorSyncOrAsync<TIn, {
next: TIn[];
previous: TIn[];
value: TIn;
}>
-
Parameters
-
peekForward: number = 1
-
peekBackward: number = 1
Returns TTransIteratorSyncOrAsync<TIn, {
next: TIn[];
previous: TIn[];
value: TIn;
}>
To solve some problems you need to know what the next element(s) is (are) going to be, or look back at the previous value(s).
so instead of returning the simple value of the incoming iterator, an object will be returned that looks like this:
Example