@drewsonne/maya-dates / Exports / HashMap
Simple bidirectional map used to translate between indexes and values.
• new HashMap(raw
)
Create a new map from an array of values.
Name | Type | Description |
---|---|---|
raw |
(undefined | string )[] |
Array where the index represents the lookup index. |
• Private
indexToValue: (undefined
| string
)[]
• Private
valueToIndex: Object
▪ [key: string
]: number
• get
length(): number
Number of items stored in the map.
number
▸ getIndex(value
): number
Retrieve an index by value.
Name | Type |
---|---|
value |
string |
number
▸ getValue(index
): undefined
| string
Retrieve a value by index.
Name | Type |
---|---|
index |
number |
undefined
| string
▸ includes(value
): boolean
Test if a value exists within the map.
Name | Type |
---|---|
value |
string |
boolean
▸ toString(): string
Convert the map to a string representation.
string