* 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. *
()
| 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 |
no outgoing calls
no test coverage detected