A bounded map that automatically maintains a maximum number of keys by removing the oldest entries when new keys are added beyond the limit.

Extends the native Map class to provide all standard map methods while enforcing a fixed maximum size of MAX_MAP_KEYS (1000 entries).

Tracks insertion order to ensure the oldest keys are removed first when the limit is exceeded. This provides LRU-like behavior based on insertion time rather than access time.

const events = new BMap()
events.set('event', 1) // Automatically removes oldest if over 1000

Type Parameters

  • TKey
  • TValue

Hierarchy

Constructors

Methods

Constructors

  • Type Parameters

    • TKey
    • TValue

    Parameters

    • Optionalentries: null | readonly (readonly [TKey, TValue])[]

    Returns BMap<TKey, TValue>

  • Type Parameters

    • TKey
    • TValue

    Parameters

    • Optionaliterable: null | Iterable<readonly [TKey, TValue], any, any>

    Returns BMap<TKey, TValue>

Methods