* Returns an iterator of `[key, values]` pairs, where `values` is the list * of values associated with that key in insertion order. * * Use this when you need both the key and its full value list, for example * to filter by bucket size. For individual `[key, value]` pairs, use * {@lin
()
| 518 | * ``` |
| 519 | */ |
| 520 | groups(): IterableIterator<[K, V[]]> { |
| 521 | // Hand-rolled for consistency with `entries()` / `values()`. See |
| 522 | // `entries()` for the rationale. One yield per bucket (no inner loop). |
| 523 | const outer = this.#map[Symbol.iterator](); |
| 524 | const iter: IterableIterator<[K, V[]]> = { |
| 525 | next(): IteratorResult<[K, V[]]> { |
| 526 | const outerResult = outer.next(); |
| 527 | if (outerResult.done) return { value: undefined, done: true }; |
| 528 | return { |
| 529 | value: [outerResult.value[0], outerResult.value[1].slice()], |
| 530 | done: false, |
| 531 | }; |
| 532 | }, |
| 533 | [Symbol.iterator]() { |
| 534 | return this; |
| 535 | }, |
| 536 | }; |
| 537 | return iter; |
| 538 | } |
| 539 | |
| 540 | /** |
| 541 | * Returns an iterator of all distinct keys in the map, in insertion order. |
no outgoing calls
no test coverage detected