MCPcopy Create free account
hub / github.com/FlashpointProject/launcher / _nodeIterator

Method _nodeIterator

src/back/util/map.ts:291–314  ·  view source on GitHub ↗
(node: TernarySearchTreeNode<K, V>)

Source from the content-addressed store, hash-verified

289 }
290
291 private _nodeIterator(node: TernarySearchTreeNode<K, V>): Iterator<V> {
292 let res: { done: false; value: V; };
293 let idx: number;
294 let data: V[];
295 const next = (): IteratorResult<V> => {
296 if (!data) {
297 // lazy till first invocation
298 data = [];
299 idx = 0;
300 this._forEach(node, value => data.push(value));
301 }
302 if (idx >= data.length) {
303 return { done: true, value: undefined };
304 }
305
306 if (!res) {
307 res = { done: false, value: data[idx++] };
308 } else {
309 res.value = data[idx++];
310 }
311 return res;
312 };
313 return { next };
314 }
315
316 forEach(callback: (value: V, index: K) => any) {
317 this._forEach(this._root, callback);

Callers 1

findSuperstrMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected