memo-obj
Version:
A deep structural memoization utility for objects to reuse identical shapes and references efficiently.
20 lines (19 loc) • 758 B
text/typescript
export declare class WeakRefsSet<T extends object = object> {
#private;
protected set: Set<WeakRef<T>>;
get size(): number;
get(value: T): WeakRef<T> | undefined;
addRef(ref: WeakRef<T>): this;
add(value: T, check?: boolean): this;
clear(fast?: boolean): void;
deleteRef(value: WeakRef<T>): boolean;
delete(value: T): boolean;
forEach(callbackfn: (value: WeakRef<T>, value2: WeakRef<T>, set: Set<WeakRef<T>>) => void, thisArg?: any): void;
hasRef(value: WeakRef<T>): boolean;
has(value: T): boolean;
entries(): SetIterator<[WeakRef<T>, WeakRef<T>]>;
keys(): SetIterator<WeakRef<T>>;
values(): SetIterator<WeakRef<T>>;
[Symbol.iterator](): SetIterator<WeakRef<T>>;
}
export default WeakRefsSet;