@beenotung/tslib
Version:
utils library in Typescript
33 lines (32 loc) • 824 B
TypeScript
/**
* map of value or map, aka nested map
*
* example use cases:
* - memorized function parameter lookup
*
* K can be any type
* */
export declare class MapMap<K, V> {
private m;
constructor();
has(k: K): boolean;
get(k: K): V | undefined;
set(k: K, v: V): Map<K, V>;
/**
* @returns true if an element in the Map existed and has been removed, or false if the element does not exist.
*/
delete(k: K): boolean;
getMap(k: K): (V | undefined) & MapMap<any, any>;
clear(): void;
}
/**
* Key can only be number, string or symbol
* */
export declare class SimpleMapMap<K extends PropertyKey, V> {
private o;
has(k: K): boolean;
get(k: K): V | undefined;
set(k: K, v: V): void;
getMap(k: K): (V | undefined) & SimpleMapMap<any, any>;
clear(): void;
}