https://github.com/gnlow/infinite-array
Infinite array mapping for JS
https://github.com/gnlow/infinite-array
array infinite lazy
Last synced: 8 months ago
JSON representation
Infinite array mapping for JS
- Host: GitHub
- URL: https://github.com/gnlow/infinite-array
- Owner: gnlow
- License: mit
- Created: 2020-06-23T02:51:42.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-27T14:45:33.000Z (almost 5 years ago)
- Last Synced: 2024-12-30T14:49:03.244Z (9 months ago)
- Topics: array, infinite, lazy
- Language: TypeScript
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# infinite-array
Infinite array for JS
## Use (Deno)
```ts
import infiniteArray from "https://raw.githubusercontent.com/gnlow/infinite-array/master/mod.ts"const x2 = infiniteArray(n => n * 2)
const [a, b] = x2console.log(a, b) // 0 2
console.log(x2[123]) // 246
```
## How it works
- `x[123]`: Proxy - get handler
- `[a, b] = x`: Symbol.iterator