1.0.0 • Published 5 years ago

array-carousel v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

array-carousel

Navigate through an array indefinitely. This allows you to use negative and out of range indexes on any given array.

Install

$ yarn add array-carousel # or npm i array-carousel

Usage

const carousel = require('array-carousel');

// Adds infinite (positive and negative) index support to any given array
const unicorn = carousel(['pony', 'cake', 'rainbow']);

console.log(unicorn[-1]) // 'rainbow'
console.log(unicorn[-9]) //'pony'
console.log(unicorn[4]) // 'cake'

unicorn[1] = null
console.log(unicorn[1]) // null

License

MIT