@push.rocks/lik
Version:
Provides a collection of lightweight helpers and utilities for Node.js projects.
26 lines (25 loc) • 823 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;
addToMap(keyArg: string, objectArg: T, optionsArg?: {
force: boolean;
}): boolean;
getByKey(keyArg: string): T;
removeFromMap(keyArg: string): T;
getKeys(): string[];
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>;
}