@push.rocks/lik
Version:
Provides a collection of lightweight helpers and utilities for Node.js projects.
31 lines (30 loc) • 990 B
TypeScript
/**
* fast map allows for very quick lookups of objects with a unique key
*/
export declare class FastMap<T> {
private mapObject;
isUniqueKey(keyArg: string): boolean;
has(keyArg: string): boolean;
get size(): number;
addToMap(keyArg: string, objectArg: T, optionsArg?: {
force: boolean;
}): boolean;
getByKey(keyArg: string): T | undefined;
removeFromMap(keyArg: string): T;
getKeys(): string[];
values(): T[];
entries(): [string, T][];
clean(): void;
/**
* returns a new Fastmap that includes all values from this and all from the fastmap in the argument
*/
concat(fastMapArg: FastMap<T>): FastMap<T>;
/**
* tries to merge another Fastmap
* Note: uniqueKeyCollisions will cause overwrite
* @param fastMapArg
*/
addAllFromOther(fastMapArg: FastMap<T>): void;
find(findFunctionArg: (mapItemArg: T) => Promise<boolean>): Promise<T>;
[Symbol.iterator](): Iterator<[string, T]>;
}