UNPKG

1.15 kBTypeScriptView Raw
1/**
2 * A convenience class for managing a "map of maps" of arbitrary depth
3 */
4export declare class MultiKeyMap<K, V> {
5 private readonly keyLength;
6 private rootMap;
7 constructor(keyLength: number);
8 static create<S, T>(keyLength: number, data: [S[], T][]): MultiKeyMap<S, T>;
9 set(key: readonly K[], value: V): V | undefined;
10 get(key: readonly K[]): V | undefined;
11 /**
12 * Checks whether the given key is present in the map
13 * @param key the key to test. It can have a length < the key length
14 * @returns whether the key exists
15 */
16 has(key: readonly K[]): boolean;
17 /**
18 * Deletes the value with the given key from the map
19 * @param key the key to remove. It can have a length < the key length
20 * @returns whether the key was present in the map
21 */
22 delete(key: readonly K[]): boolean;
23 /**
24 * Iterates over all entries in the map. The ordering semantics are like iterating over a map of maps.
25 * @param handler Handler for each entry
26 */
27 forEach(handler: (value: V, key: K[]) => void): void;
28 private doForeach;
29}
30//# sourceMappingURL=collections.d.ts.map
\No newline at end of file