ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
15 lines (14 loc) • 485 B
TypeScript
export declare class KeyValueCache<T, U> {
private readonly cacheItems;
constructor();
getSize(): number;
getValues(): IterableIterator<U>;
getKeys(): IterableIterator<T>;
getEntries(): IterableIterator<[T, U]>;
getOrCreate<TCreate extends U = U>(key: T, createFunc: () => TCreate): TCreate;
has(key: T): boolean;
get(key: T): U | undefined;
set(key: T, value: U): void;
replaceKey(key: T, newKey: T): void;
removeByKey(key: T): void;
}