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

Method toMap

data_structures/unstable_multimap.ts:641–647  ·  view source on GitHub ↗

* Returns a new code Map snapshot of the multimap, with each key * mapped to a fresh array of its values in insertion order. * * The returned map and its value arrays are owned by the caller; mutating * them does not affect the multimap, and later mutations to the multimap * ar

()

Source from the content-addressed store, hash-verified

639 * ```
640 */
641 toMap(): Map<K, V[]> {
642 const result = new Map<K, V[]>();
643 for (const [key, list] of this.#map) {
644 result.set(key, list.slice());
645 }
646 return result;
647 }
648
649 /**
650 * Returns an iterator of all `[key, value]` pairs, with each value yielded

Callers 1

Calls 2

setMethod · 0.65
sliceMethod · 0.45

Tested by

no test coverage detected