Expand description
The one { value, done } iterator protocol used by every
web-platform collection class (Headers, URLSearchParams,
FormData).
WHATWG iteration is LIVE: mutations made during a loop are observed,
so for (const [k] of params) params.delete(k) behaves as it does in
Node. The iterator therefore holds no snapshot — it re-reads its
parent on every next().
The parent is carried as a property ON the iterator object, which the
JS GC traces, and re-read per call. The native next closure captures
nothing from the JS heap, per the GC-cycle discipline: a closure that
captured the parent Class would be invisible to the collector and
could strand the runtime at teardown.
Functions§
- live_
iterator - Build a live iterator over
parent, projecting each position throughproject. The result is itself iterable ([Symbol.iterator]returnsthis), so it works withfor..of, spread andArray.from.
Type Aliases§
- Project
- Yield the entry at
index, orNoneonce the collection is exhausted. Called with the parent freshly borrowed, so it always sees current state.