ProtectedconstructorProtected constructor used internally by BlobDictionary.new
and BlobDictionary.fromEntries.
This enforces controlled instantiation — users should create instances through the provided static factory methods instead of calling the constructor directly.
The threshold that determines when the dictionary
switches from using an array-based (ListChildren) node to a map-based (MapChildren) node for storing entries.
Returns the number of entries in the dictionary.
The count is derived from the auxiliary keyvals map, which stores
all original key references and their associated values. This ensures
that the size reflects the actual number of entries, independent of
internal overrides in the main root structure.
The total number of entries in the dictionary.
Removes an entry with the specified key from the dictionary.
Internally, this calls internalSet with undefined to mark the entry as deleted.
The key of the entry to remove.
true if an entry was removed (i.e. the key existed), otherwise false.
Retrieves the value associated with the given key from the dictionary.
If the key does not exist, this method returns undefined.
The key whose associated value should be retrieved.
The value associated with the specified key, or undefined if the key is not present.
Checks whether the dictionary contains an entry for the given key.
⚠️ Note: Avoid using has(...) together with get(...) in a pattern like this:
if (dict.has(key)) {
const value = dict.get(key);
...
}
This approach performs two lookups for the same key.
Instead, prefer the following pattern, which retrieves the value once:
const value = dict.get(key);
if (value !== undefined) {
...
}
The key to check for.
true if the dictionary contains an entry for the given key, otherwise false.
Adds a new entry to the dictionary or updates the value of an existing key.
If an entry with the given key already exists, its value is replaced with the new one.
Nothing (void).
Creates a new sorted array of values, ordered by their corresponding keys.
Iterates over all entries in the dictionary and sorts them according to the provided comparator function applied to the keys.
A comparator function that can compare two keys.
A new array containing all values from the dictionary, sorted according to their keys.
StaticfromStaticnewCreates an empty BlobDictionary.
The threshold that determines when the dictionary
switches from using an array-based (ListChildren) node to a map-based (MapChildren) node for storing entries.
Defaults to 0.
A new, empty BlobDictionary instance.
A map which uses byte blobs as keys