Type Parameters
K
V extends Record<string, any>
Constructors
constructor
- new SortedMap<K, V>(initialEntries?, compare?): SortedMap<K, V>
Type Parameters
K
V extends Record<string, any>
Parameters
Optional
initialEntries: Iterable<readonly [K, V]>
Optional
compare: string | Comparator<K, V>
Properties
Private
compare
compare: Comparator<K, V> Private
map
Private
sortedKeys
Accessors
size
- get size(): number
Returns number
Methods
[iterator]
- [iterator](): Iterator<[K, V], any, undefined>
Returns Iterator<[K, V], any, undefined>
Private
binarySearch
- binarySearch(key, value): number
Returns number
clear
- clear(): void
Returns void
delete
- delete(key): boolean
Returns boolean
entries
- entries(): IterableIterator<[K, V]>
Returns IterableIterator<[K, V]>
first
- first(): undefined | [K, V]
Returns undefined | [K, V]
get
- get(key): undefined | V
Returns undefined | V
has
- has(key): boolean
Returns boolean
keys
- keys(): IterableIterator<K>
Returns IterableIterator<K>
last
- last(): undefined | [K, V]
Returns undefined | [K, V]
range
- range(options?): IterableIterator<[K, V]>
Parameters
options: {
direction?: "asc" | "desc";
gte?: K;
lte?: K;
} = {}
Optional
direction?: "asc" | "desc"
Optional
gte?: K
Optional
lte?: K
Returns IterableIterator<[K, V]>
reverse
- reverse(): Iterator<[K, V], any, undefined>
Returns Iterator<[K, V], any, undefined>
set
- set(key, value): void
Returns void
values
- values(): IterableIterator<V>
Returns IterableIterator<V>