infinite-array

Infinite array index using ES2015 Proxy

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
infinite-array
901.1.05 years ago5 years agoMinified + gzip package size for infinite-array in KB

Readme

infinite-array Build Status
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