interface MapReturnType extends Map { /** The max size of the map */ max: number; /** The raw map setter */ _set: (key: any, val: any) => any; /** The raw map getter */ _get: (key: any) => any; } /** * Apply a size limit to a map by evicting the least-recently-used (aka LRU) * items. Works by monkey-patching the get and set of a map instance * * Warning: This hurts performance of _map.get and _map.set vs a normal map * * @param map * the map to limit * * @param maxSize * the max size of the map * * @returns * the map with new types added. Note that the map is modified in-place, but * returned with added types for type-safety and convenience * * @example * ```typescript * const t = mapApplyMaxSize(new Map(), 2) * t.set('a', 1) * t.set('b', 2) * t.set('a', 1) * t.set('c', 3) // should evict 'b' * expect(t.get('b')).toBeUndefined() * t.set('d', 4) // should evict 'a' * expect(t.get('a')).toBeUndefined() * t.get('c') * t.set('e', 5) // should evict 'd' * expect(t.get('d')).toBeUndefined() * ``` */ export declare function mapApplyMaxSize( /** The map to limit */ map: Map, /** The max size of the map */ maxSize: number): MapReturnType; export {};