Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/homerchen19/infinite-array
∞ Infinite array index using ES2015 Proxy
https://github.com/homerchen19/infinite-array
Last synced: 1 day 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 (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-16T07:19:39.000Z (over 6 years ago)
- Last Synced: 2024-10-12T14:39:31.120Z (27 days ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/infinite-array
- Size: 49.8 KB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# infinite-array [![Build Status](https://travis-ci.org/xxhomey19/infinite-array.svg?branch=master)](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)