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
Name | Type | Description |
---|---|---|
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
Name | Type |
---|---|
key | K |
Returns
CompositeKeyMap
<K
, V
>
Defined in
libs/common/util/CompositeKeyMap.ts:34
get
▸ get(key
): undefined
| V
Parameters
Name | Type |
---|---|
key | K |
Returns
undefined
| V
Defined in
libs/common/util/CompositeKeyMap.ts:30
has
▸ has(key
): boolean
Parameters
Name | Type |
---|---|
key | K |
Returns
boolean
Defined in
libs/common/util/CompositeKeyMap.ts:26
hash
▸ Private
hash(key
): string
Parameters
Name | Type |
---|---|
key | K |
Returns
string
Defined in
libs/common/util/CompositeKeyMap.ts:17
set
▸ set(key
, item
): CompositeKeyMap
<K
, V
>
Parameters
Name | Type |
---|---|
key | K |
item | V |
Returns
CompositeKeyMap
<K
, V
>