Creates a deferred sequence of adjacent element pairs drawn from the source iterable.
Type of elements within the source iterable.
source
The source iterable.
Optional
Optional projection applied to each current/next pair. Defaults to returning [current, next].
[current, next]
A sequence with one element per consecutive pair from source.
The final element is omitted because it lacks a successor. source is enumerated lazily and exactly once.
const numbers = [1, 2, 3, 4];const pairs = pairwise(numbers).toArray();console.log(pairs); // [[1, 2], [2, 3], [3, 4]] Copy
const numbers = [1, 2, 3, 4];const pairs = pairwise(numbers).toArray();console.log(pairs); // [[1, 2], [2, 3], [3, 4]]
Creates a deferred sequence of adjacent element pairs drawn from the source iterable.