UNPKG

circular-at

Version:

Access array items at any positive or negative index. If the index is out of bounds, it will be wrapped around the length of the array.

7 lines (3 loc) 89 B
const at = require('circular-at') const array = ['a', 'b', 'c'] at(array, -5) === 'b'