An open API service indexing awesome lists of open source software.

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

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] = x2

console.log(a, b) // 0 2
console.log(x2[123]) // 246
```
## How it works
- `x[123]`: Proxy - get handler
- `[a, b] = x`: Symbol.iterator