An adapter around a WeakMap to fulfill the Map interface.

Note that this class does not change the inherent behaviour of a WeakMap. All methods that iterate over keys or values will throw an error, and references are still weak.

However, the adapter does enable the use of the clear method and keeps track of the size, by updating a counter when using the appropriate set, delete, and clear methods.

Type Parameters

  • K extends object

  • V

Hierarchy

  • WeakMapAdapter

Implements

  • Map<K, V>

Constructors

Properties

Accessors

Methods

Constructors

Properties

[toStringTag]: "WeakMapAdapter" = 'WeakMapAdapter'

Accessors

Methods

  • Throws an error, because iterating is not supported in WeakMaps.

    Parameters

    • Optional callbackfn: ((value: V, key: K, map: Map<K, V>) => void)

      callback function, never used

        • (value: V, key: K, map: Map<K, V>): void
        • Parameters

          • value: V
          • key: K
          • map: Map<K, V>

          Returns void

    • Optional thisArg: any

      thisArg, never used

    Returns never

Generated using TypeDoc