Options
All
  • Public
  • Public/Protected
  • All
Menu

Map to weakly held values.

Type parameters

  • K

    Type of keys.

  • V: object

    Type of values. Must be objects, so that they may be weakly referenced.

Hierarchy

  • WeakValueMap

Index

Constructors

  • new WeakValueMap<K, V>(entries?: Iterable<readonly [K, V]>): WeakValueMap<K, V>
  • Construct a WeakValueMap. Optionally pass initial entries.

    Type parameters

    • K

    • V: object

    Parameters

    • Optional entries: Iterable<readonly [K, V]>

      Entries to initially insert.

    Returns WeakValueMap<K, V>

Accessors

  • Returns the WeakValueMap constructor. Override in subclasses for idiomatic inheritance.

    Returns typeof WeakValueMap

Methods

  • [iterator](): IterableIterator<[K, V]>
  • Get iterator over the map entries. Equivalent to WeakValueMap.prototype.entries().

    Returns IterableIterator<[K, V]>

  • clean(): void
  • Searches all entries in the map, deleting those who's values have been destroyed. Usually, entries are deleted only on an access to an existing, non-referenceable value.

    Returns void

  • clear(): void
  • Remove all entries from the map.

    Returns void

  • delete(key: K): boolean
  • Delete an entry from the map.

    Parameters

    • key: K

      Key of entry.

    Returns boolean

    Results in a boolean indicating if the map contained an entry associated with key before attempting deletion.

  • entries(): IterableIterator<[K, V]>
  • Get iterator over the map entries.

    Returns IterableIterator<[K, V]>

  • forEach(callback: (value: V, key: K, map: WeakValueMap<K, V>) => void, thisArg?: any): void
  • Call a function for each entry of the map.

    Parameters

    • callback: (value: V, key: K, map: WeakValueMap<K, V>) => void

      Iteratee.

    • Optional thisArg: any

      this value applied on calls to callback.

    Returns void

  • get(key: K): undefined | V
  • Gets value associated with a key in the map.

    Parameters

    • key: K

      Key of entry whose value to retrieve.

    Returns undefined | V

    Value of associated entry, or undefined if non-existant, or expired.

  • has(key: K): boolean
  • Check if the map contains a key.

    Parameters

    • key: K

    Returns boolean

    Wether the map contains a referenceable entry associated with key.

  • keys(): IterableIterator<K>
  • Get iterator over the map keys.

    Returns IterableIterator<K>

  • Set entry in the map.

    Parameters

    • key: K
    • value: V

    Returns WeakValueMap<K, V>

    The map, for the purposes of chaining.

  • values(): IterableIterator<V>
  • Get iterator over the map values.

    Returns IterableIterator<V>

Generated using TypeDoc