https://github.com/homerchen19/infinite-array
∞ Infinite array index using ES2015 Proxy
https://github.com/homerchen19/infinite-array
Last synced: 3 months ago
JSON representation
∞ Infinite array index using ES2015 Proxy
- Host: GitHub
- URL: https://github.com/homerchen19/infinite-array
- Owner: homerchen19
- License: mit
- Created: 2017-12-10T10:18:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-16T07:19:39.000Z (over 7 years ago)
- Last Synced: 2025-03-20T10:19:43.646Z (4 months ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/infinite-array
- Size: 49.8 KB
- Stars: 9
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# infinite-array [](https://travis-ci.org/xxhomey19/infinite-array)
Inspired by [sindresorhus/negative-array](https://github.com/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
```js
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](https://github.com/xxhomey19)