Class MultiKeyMap<Key, V>

A utility class that works like a Map, but accepts multiple values as the key for each value.

Type Parameters

  • const Key extends readonly any[]

  • const V

Hierarchy

  • MultiKeyMap

Constructors

  • Type Parameters

    • const Key extends readonly any[]

    • const V

    Parameters

    • Optional entries: null | MultiKeyMap<Key, V> | readonly (readonly [Key, V])[]

    Returns MultiKeyMap<Key, V>

Accessors

  • get size(): number
  • Get the number of entries in the map.

    Returns number

Methods

  • Delete the value for a given key.

    Time complexity: O(1), given that the length of the key is constant.

    Parameters

    Returns boolean

  • Get an iterator for all entries in the map.

    Returns Generator<[key: Key, value: V], any, unknown>

  • Call a function for each entry in the map.

    Parameters

    • callbackfn: ((value, key, map) => void)
        • (value, key, map): void
        • Parameters

          Returns void

    • Optional thisArg: any

    Returns void

  • Get a value for a given key.

    Time complexity: O(1), given that the length of the key is constant.

    Parameters

    Returns undefined | V

  • Check if a value exists for a given key.

    Time complexity: O(1), given that the length of the key is constant.

    Parameters

    Returns boolean

  • Add or update a value for a given key.

    Time complexity: O(1), given that the length of the key is constant.

    Parameters

    Returns MultiKeyMap<Key, V>