bi-directional-map
Version:
Simple bi directional map implementation using 2 es6 maps
19 lines (18 loc) • 623 B
TypeScript
export declare class BiDirectionalMap<K, V> {
private readonly map;
private readonly reverse;
constructor(map?: object | Map<K, V> | Array<[K, V]>);
readonly size: number;
set(key: K, value: V): this;
clear(): void;
getValue(key: K): V;
getKey(value: V): K;
deleteKey(key: K): boolean;
deleteValue(value: V): boolean;
hasKey(key: K): boolean;
hasValue(value: any): boolean;
keys(): IterableIterator<K>;
values(): IterableIterator<V>;
entries(): IterableIterator<[K, V]>;
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
}