یادداشتهای انتشار به انگلیسی نوشته شدهاند.
Iterator Helpers: lazy map/filter/take/drop over any iterator
The ES2025 Iterator Helpers, the standard toolkit for LAZY data pipelines - `.map`, `.filter`, `.take`, `.drop`, `.flatMap` (which return a new lazy iterator) and `.reduce`, `.toArray`, `.forEach`, `.some`, `.every`, `.find` (which consume one). They ride on the generators shipped in 0.1.103: because they are lazy, they run over an INFINITE generator as long as the pipeline is finitely consumed - `nats().map(x => x*2).take(4).toArray()` returns `[0,2,4,6]` and never hangs, and `.some`/`.find` stop pulling the instant the answer is known. Every iterator inherits them from one shared prototype: generators, `[1,2,3].values()`, Set/Map iterators, and `Iterator.from(anyIterable)`, so `[1,2,3,4,5].values().map(x=>x*x).filter(x=>x>4).toArray()` just works. JavaScript language moves 80 to 81; overall holds at 50. 14 behaviour tests, gate 6375/6375.
چه چیزی تغییر کرد
3 تغییر- نمایش صفحهAdded the lazy Iterator Helpers - `.map(fn)`, `.filter(fn)`, `.take(n)`, `.drop(n)`, `.flatMap(fn)` - each returning a NEW iterator that pulls its source one value at a time. Chaining stays lazy end to end: `nats().map(...).filter(...).take(3).toArray()` over an infinite generator terminates after producing exactly three values, and a map callback that would throw on the fourth never fires. Built on the 0.1.103 generator machinery.
- نمایش صفحهAdded the terminal Iterator Helpers - `.reduce(fn[, seed])`, `.toArray()`, `.forEach(fn)`, `.some(fn)`, `.every(fn)`, `.find(fn)` - which drive the iterator to completion or short-circuit. `.some`/`.every`/`.find` stop pulling the moment the result is decided, so they return over an infinite generator (`nats().find(x => x===7)` is `7`). `.reduce` with no seed uses the first element and throws on an empty iterator, per spec.
- JavaScript و JITEvery iterator now inherits the helpers from one shared `Iterator.prototype` via the prototype chain, so generators, `Array.prototype.values()`, Set/Map iterators and helper-iterators all carry them - no per-object cost. Added the `Iterator` global with `Iterator.from(x)`, which wraps any iterable or iterator so the helpers apply to it. A helper-iterator is itself iterable, so spread and for-of consume it (`[...g().map(x=>x*2)]`).




