@gabrielrufino/cube
Version:
Data structures made in Typescript
22 lines (21 loc) • 715 B
TypeScript
import type IDictionary from './IDictionary';
import type IDictionaryData from './IDictionaryData';
export default class Dictionary<T = number> implements IDictionary<T> {
private _data;
constructor(inputs?: Readonly<{
[key: string]: T;
}>);
get data(): IDictionaryData<T>;
get size(): number;
get isEmpty(): boolean;
get keys(): string[];
get values(): T[];
get pairs(): [string, T][];
set(key: string, value: T): [string, T];
remove(key: string): [string, T] | null;
hasKey(key: string): boolean;
get(key: string): T | null;
clear(): IDictionaryData<T>;
forEach(func: (_key: string, _value: T) => any): void;
private [Symbol.toPrimitive];
}