MCPcopy
hub / github.com/Effect-TS/effect / HashMapIterator

Class HashMapIterator

packages/effect/src/internal/hashMap.ts:110–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110class HashMapIterator<in out K, in out V, out T> implements IterableIterator<T> {
111 v: Option.Option<VisitResult<K, V, T>>
112
113 constructor(readonly map: HashMapImpl<K, V>, readonly f: TraversalFn<K, V, T>) {
114 this.v = visitLazy(this.map._root, this.f, undefined)
115 }
116
117 next(): IteratorResult<T> {
118 if (Option.isNone(this.v)) {
119 return { done: true, value: undefined }
120 }
121 const v0 = this.v.value
122 this.v = applyCont(v0.cont)
123 return { done: false, value: v0.value }
124 }
125
126 [Symbol.iterator](): IterableIterator<T> {
127 return new HashMapIterator(this.map, this.f)
128 }
129}
130
131const applyCont = <K, V, A>(cont: Cont<K, V, A>): Option.Option<VisitResult<K, V, A>> =>
132 cont

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected