https://github.com/kermanx/lazy-iterator
Yet another impl of lazy-calculated iteration.
https://github.com/kermanx/lazy-iterator
Last synced: about 1 month ago
JSON representation
Yet another impl of lazy-calculated iteration.
- Host: GitHub
- URL: https://github.com/kermanx/lazy-iterator
- Owner: kermanx
- License: apache-2.0
- Created: 2023-06-16T09:58:41.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-12T06:52:13.000Z (almost 3 years ago)
- Last Synced: 2025-03-21T10:15:42.339Z (about 1 year ago)
- Language: TypeScript
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lazy-iterator
Yet another package for lazy iteration in JavaScript.
- Full TypeScript support
- No dependencies
## Installation
```bash
npm install @kermanx/lazy-iterator
```
## Usage
```typescript
import { lazyIteratorFactory } from "@kermanx/lazy-iterator";
const iterator = lazyIteratorFactory.from([1, 2, 3]).map((x) => x * 2);
for (const x of iterator) {
console.log(x);
}
```
**You can extend the `LazyIterator` and `LazyIteratorFactory` class to create your own lazy iterators.** See [src/iterator.ts](./src/iterator.ts) for details.