/** * A `Map` whose values are `Set`s, so a key holds many values without a caller ever having to create the inner set or * clean it up. Deleting a key's last value through {@link SetMap.delete} drops the key with it, so a long-lived map * does not accumulate one entry per key it has ever seen. Emptying the live set from {@link SetMap.get} is the one way * to leave a key behind with nothing in it, and it stays until something deletes the key outright. */ export default class SetMap { private map; /** * Adds `value` under `key`, creating the set on first use. Returns the map so calls chain, the way * `Map.prototype.set` does. */ add(key: K, value: V): this; /** * Removes `value` from `key`, dropping the key itself when that was its last value. Returns whether it removed * anything, the way `Set.prototype.delete` does: `false` when the key is absent or does not hold `value`, and the * map is left untouched in both cases. It reports only on the pair it was asked about, so a key already emptied * through {@link SetMap.get} is not pruned here either. */ delete(key: K, value: V): boolean; /** * Drops the key and every value under it at once. Returns whether the key was there, the way `Map.prototype.delete` * does. */ deleteKey(key: K): boolean; /** * Empties the map. */ clear(): void; /** * The values under `key` as an array, empty when the key is absent. A snapshot, so it is safe to iterate while * deleting from the map - unlike the live set {@link SetMap.get} returns. */ valuesForKey(key: K): V[]; /** * Every key the map is holding. A key emptied through {@link SetMap.get} stays until it is deleted. */ get keys(): K[]; /** * Every value across every key, flattened in insertion order. Values are not deduplicated across keys. */ get values(): V[]; /** * The live set backing `key`, or `undefined` when the key is absent. Mutating it bypasses the empty-key cleanup that * {@link SetMap.delete} does, so prefer the methods above unless you need the set itself. */ get(key: K): Set | undefined; /** * Whether `value` is stored under `key`. */ has(key: K, value: V): boolean; } //# sourceMappingURL=set_map.d.ts.map