Defined in: packages/db/src/SortedMap.ts:8
A Map implementation that keeps its entries sorted based on a comparator function
TKey extends string | number
The type of keys in the map (must be string | number)
TValue
The type of values in the map
new SortedMap<TKey, TValue>(comparator?): SortedMap<TKey, TValue>;
new SortedMap<TKey, TValue>(comparator?): SortedMap<TKey, TValue>;
Defined in: packages/db/src/SortedMap.ts:19
Creates a new SortedMap instance
(a, b) => number
Optional function to compare values for sorting. If not provided, entries are sorted by key only.
SortedMap<TKey, TValue>
get size(): number;
get size(): number;
Defined in: packages/db/src/SortedMap.ts:157
Gets the number of key-value pairs in the map
number
iterator: IterableIterator<[TKey, TValue]>;
iterator: IterableIterator<[TKey, TValue]>;
Defined in: packages/db/src/SortedMap.ts:166
Default iterator that returns entries in sorted order
IterableIterator<[TKey, TValue]>
An iterator for the map's entries
clear(): void;
clear(): void;
Defined in: packages/db/src/SortedMap.ts:149
Removes all key-value pairs from the map
void
delete(key): boolean;
delete(key): boolean;
Defined in: packages/db/src/SortedMap.ts:125
Removes a key-value pair from the map
TKey
The key to remove
boolean
True if the key was found and removed, false otherwise
entries(): IterableIterator<[TKey, TValue]>;
entries(): IterableIterator<[TKey, TValue]>;
Defined in: packages/db/src/SortedMap.ts:177
Returns an iterator for the map's entries in sorted order
IterableIterator<[TKey, TValue]>
An iterator for the map's entries
forEach(callbackfn): void;
forEach(callbackfn): void;
Defined in: packages/db/src/SortedMap.ts:208
Executes a callback function for each key-value pair in the map in sorted order
(value, key, map) => void
Function to execute for each entry
void
get(key): TValue | undefined;
get(key): TValue | undefined;
Defined in: packages/db/src/SortedMap.ts:115
Gets a value by its key
TKey
The key to look up
TValue | undefined
The value associated with the key, or undefined if not found
has(key): boolean;
has(key): boolean;
Defined in: packages/db/src/SortedMap.ts:142
Checks if a key exists in the map
TKey
The key to check
boolean
True if the key exists, false otherwise
keys(): IterableIterator<TKey>;
keys(): IterableIterator<TKey>;
Defined in: packages/db/src/SortedMap.ts:186
Returns an iterator for the map's keys in sorted order
IterableIterator<TKey>
An iterator for the map's keys
set(key, value): this;
set(key, value): this;
Defined in: packages/db/src/SortedMap.ts:92
Sets a key-value pair in the map and maintains sort order
TKey
The key to set
TValue
The value to associate with the key
this
This SortedMap instance for chaining
values(): IterableIterator<TValue>;
values(): IterableIterator<TValue>;
Defined in: packages/db/src/SortedMap.ts:195
Returns an iterator for the map's values in sorted order
IterableIterator<TValue>
An iterator for the map's values
