maya-dates

@drewsonne/maya-dates / Exports / HashMap

Class: HashMap

Simple bidirectional map used to translate between indexes and values.

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new HashMap(raw)

Create a new map from an array of values.

Parameters

Name Type Description
raw (undefined | string)[] Array where the index represents the lookup index.

Defined in

structs/hashMap.ts:13

Properties

indexToValue

Private indexToValue: (undefined | string)[]

Defined in

structs/hashMap.ts:6


valueToIndex

Private valueToIndex: Object

Index signature

▪ [key: string]: number

Defined in

structs/hashMap.ts:5

Accessors

length

get length(): number

Number of items stored in the map.

Returns

number

Defined in

structs/hashMap.ts:51

Methods

getIndex

getIndex(value): number

Retrieve an index by value.

Parameters

Name Type
value string

Returns

number

Defined in

structs/hashMap.ts:37


getValue

getValue(index): undefined | string

Retrieve a value by index.

Parameters

Name Type
index number

Returns

undefined | string

Defined in

structs/hashMap.ts:30


includes

includes(value): boolean

Test if a value exists within the map.

Parameters

Name Type
value string

Returns

boolean

Defined in

structs/hashMap.ts:44


toString

toString(): string

Convert the map to a string representation.

Returns

string

Defined in

structs/hashMap.ts:58