infinite-array
v1.1.0
Published
Infinite array index using ES2015 Proxy
Downloads
175
Maintainers
Readme
infinite-array
Inspired by sindresorhus/negative-array, infinite-array
supports index which is negative, positive and even bigger than array's length.
Support TypeScript recently.
Install
$ npm install infinite-array
Usage
import infiniteArray from 'infinite-array';
const nba = infiniteArray(['N', 'B', 'A']);
console.log(nba[-6]); // N
console.log(nba[-5]); // B
console.log(nba[-4]); // A
console.log(nba[-3]); // N
console.log(nba[-2]); // B
console.log(nba[-1]); // A
console.log(nba[0]); // N
console.log(nba[1]); // B
console.log(nba[2]); // A
console.log(nba[3]); // N
console.log(nba[4]); // B
console.log(nba[5]); // A
License
MIT © xxhomey19