enumerate<T>(iter?: AsyncIterable<T>
| Iterable<T>
| null): Enumerable<T>
Create an Enumerable from any iterable or async iterable.
This is the factory function for creating Enumerable instances. It provides a fluent API for working with async data streams, making it easy to chain operations like map, filter, and transform.
Important: This function wraps an iterable but does NOT add index counters.
To add index counters, call .enum() on the returned Enumerable.
Why use Enumerable?
- Composable operations via method chaining
- Works seamlessly with async data
- Integrates with process I/O
- Lazy evaluation for memory efficiency
- Type-safe transformations
Convert array to AsyncIterable
Convert array to AsyncIterable
import { enumerate } from "jsr:@j50n/proc"; const result = await enumerate([1, 2, 3]).collect(); // [1, 2, 3]
An Enumerable wrapping the input.