adjacents

1.0.0 • Public • Published

adjacents

A function that returns an array of the pairs of adjacent values in the input array. “Adjacent” as in next to each other in the array.

When there aren't enough elements to form pairs (0 or 1), it'll return an empty array.

Example

adjacents([ 1, 2, 3, 4 ])
[ [ 1, 2 ], [ 2, 3 ], [ 3, 4 ] ]

License

ISC.

Package Sidebar

Install

npm i adjacents

Weekly Downloads

2

Version

1.0.0

License

ISC

Last publish

Collaborators

  • an