Skip to main content

Class: CompositeKeyMap<K, V>

libs/common/util/CompositeKeyMap.CompositeKeyMap

A map that can use a composite key, i.e. a key that is an array or object. The key is hashed by running {@link hashFunction}, which is expected to output a list whose entries can be converted to string.

Based on https://stackoverflow.com/a/54523103

Type parameters

Name
K
V

Constructors

constructor

new CompositeKeyMap<K, V>(hashFunction)

Type parameters

Name
K
V

Parameters

NameTypeDescription
hashFunction(key: K) => unknown[]A function that maps from a key to a list whose entries can be converted to string

Defined in

libs/common/util/CompositeKeyMap.ts:15

Properties

map

Private map: Record<string, V> = {}

Defined in

libs/common/util/CompositeKeyMap.ts:9

Methods

delete

delete(key): CompositeKeyMap<K, V>

Parameters

NameType
keyK

Returns

CompositeKeyMap<K, V>

Defined in

libs/common/util/CompositeKeyMap.ts:34


get

get(key): undefined | V

Parameters

NameType
keyK

Returns

undefined | V

Defined in

libs/common/util/CompositeKeyMap.ts:30


has

has(key): boolean

Parameters

NameType
keyK

Returns

boolean

Defined in

libs/common/util/CompositeKeyMap.ts:26


hash

Private hash(key): string

Parameters

NameType
keyK

Returns

string

Defined in

libs/common/util/CompositeKeyMap.ts:17


set

set(key, item): CompositeKeyMap<K, V>

Parameters

NameType
keyK
itemV

Returns

CompositeKeyMap<K, V>

Defined in

libs/common/util/CompositeKeyMap.ts:21