MCPcopy Create free account
hub / github.com/denoland/std / values

Method values

data_structures/unstable_multimap.ts:588–616  ·  view source on GitHub ↗

* Returns an iterator of all individual values across all keys, in insertion * order. * * Mutating the map during iteration is not supported and may skip or repeat * values. * * @experimental **UNSTABLE**: New API, yet to be vetted. * * @returns An iterator of values. *

()

Source from the content-addressed store, hash-verified

586 * ```
587 */
588 values(): IterableIterator<V> {
589 // Hand-rolled for consistency with `entries()` / `groups()`. See
590 // `entries()` for the rationale. The bucket is snapshotted on first
591 // entry so mutations to the current bucket during iteration do not
592 // extend, truncate, or shift the visit.
593 const outer = this.#map.values();
594 let currentList: V[] | null = null;
595 let innerIndex = 0;
596 const iter: IterableIterator<V> = {
597 next(): IteratorResult<V> {
598 while (true) {
599 if (currentList !== null && innerIndex < currentList.length) {
600 return { value: currentList[innerIndex++]!, done: false };
601 }
602 const outerResult = outer.next();
603 if (outerResult.done) {
604 currentList = null;
605 return { value: undefined, done: true };
606 }
607 currentList = outerResult.value.slice();
608 innerIndex = 0;
609 }
610 },
611 [Symbol.iterator]() {
612 return this;
613 },
614 };
615 return iter;
616 }
617
618 /**
619 * Returns a new {@linkcode Map} snapshot of the multimap, with each key

Callers 15

clearMethod · 0.80
lru_cache_test.tsFile · 0.80
assertContentfulEntriesFunction · 0.80
shuffle_test.tsFile · 0.80
seeded_test.tsFile · 0.80
sample_test.tsFile · 0.80
sampleFunction · 0.80
isStatusFunction · 0.80
parseSignatureInputFunction · 0.80
escape.tsFile · 0.80
min_by_test.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected