WeakMap

A map of object keys to values with good garbage collection behavior. See WeakMap.

Methods

has(key)

Returns whether an entry with the given key exists in a Map.

get(key|index, default?)

Gets the value for a key in a map.

set(key, value)

Sets the value for a given key.

delete(key)

Deletes the value for a given key. Returns whether the key was found and successfully deleted.

Usage

var WeakMap = require("collections/weak-map");
  • WeakMap()
Source code