Interface WeakMap<K, V>

A Map object with its __mode metamethod set to "k"

interface WeakMap<K, V> {
    clear(this): void;
    delete(this, key): boolean;
    forEach(this, callbackfn): void;
    get(this, key): undefined | V;
    has(this, key): boolean;
    isEmpty(this): boolean;
    set(this, key, value): this;
    size(this): number;
}

Type Parameters

  • K extends object
  • V

Hierarchy (view full)

Methods

  • Deletes all members of the Map

    Parameters

    Returns void

  • Deletes the given key from the Map.

    Returns a boolean indicating whether or not a value was removed.

    Parameters

    Returns boolean

  • Performs the specified action for each (element / pair of elements) in the Map

    Parameters

    • this: ReadonlyMap<K, V>
    • callbackfn: ((value, key, self) => void)

      A function that accepts up to three arguments. forEach calls the callbackfn function one time for each (element / pair of elements) in the array.

        • (value, key, self): void
        • Parameters

          • value: V
          • key: K
          • self: this

          Returns void

    Returns void

  • Returns the value associated with the given key

    Parameters

    Returns undefined | V

  • Returns a boolean for whether the given key exists in the Map

    Parameters

    Returns boolean

  • Returns true if empty, otherwise false.

    Parameters

    Returns boolean

  • Associates a key with a value which can be accessed later by Map.get

    Parameters

    Returns this

  • Returns the number of elements in the Map

    Parameters

    Returns number