Better iterators for TypeScript.
While JavaScript defines Iterable and AsyncIterable interfaces, they leave a bit to be desired if you're coming from other languages (Rust, Kotlin, Java) that make more tools available on iterables.
Better Iterators aims to bring those tools to TypeScript.
For example code and API docs, see:
https://jsr.io/@nfnitloop/better-iterators
- Type-safe
- Easy to use
- Support both
Iterable
andAsyncIterable
- Support for (opt-in, bounded) async parallelism.
- Standard ECMAScript modules (works in Deno, Node, and browsers).
- No Monkey Patching
The JSR page has instructions for installing for Deno, npm, yarn, pnpm, and bun.
This package is also published to and installable via:
What makes "Better Iterators" better?
I did some searching for other Iterator libraries in TypeScript. I don't want to name names, but here are some of the problems I had with what I found:
- abandoned codebases (ex: GitHub repo archived)
- function-based APIs that make chaining operations cumbersome
- poor handling of async iteration. ex:
- No special async handling
- implementations or examples that cause unbounded parallelism.