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.
An adapter around a
WeakMap
to fulfill theMap
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 thesize
, by updating a counter when using the appropriateset
,delete
, andclear
methods.