Class: WeakMap

barejs/polyfill.WeakMap(_iterableopt)

new WeakMap(_iterableopt)

Mimics the implementation of a native WeakMap. The only way to achieve this is by putting a property on the key object.

Parameters:
Name Type Attributes Default Description
_iterable any <optional>
null

Optional: an iterable whose values will be added to the WeakSet.

Source:

Methods

delete(_key) → {boolean}

Remove the value for the specified key

Parameters:
Name Type Description
_key object

The object to use as key.

Source:
Returns:

True if the entry was deleted, false otherwise

Type
boolean

get(_key)

Get the value for the specified key

Parameters:
Name Type Description
_key object

The object to use as key.

Source:
Returns:

The value, or undefined if the key is not known.

has(_key) → {boolean}

Check if the WeakMap has an entry for the specified key

Parameters:
Name Type Description
_key object

The object to use as key.

Source:
Returns:

True if there is an entry for the key, false otherwise

Type
boolean

set(_key, _value) → {module:barejs/polyfill.WeakMap}

Adds a new element with a specified key and value to a WeakMap object.

Parameters:
Name Type Description
_key object

The object to use as key.

_value

The value to add.

Source:
Returns:

The WeakMap (for chaining)

Type
module:barejs/polyfill.WeakMap