Static
leavesThe key symbol that stores the leaves of any given node.
Insert an entry into the tree.
The string key for the entry.
The entry to store.
The node the entry was added to.
Return entries that match the given string prefix.
The prefix.
Optional
options: { filterEntries?: StringTreeEntryFilter; limit?: number } = {}Additional options to configure behaviour.
Optional
filterEntries?: StringTreeEntryFilterA filter function to apply to each candidate entry.
Optional
limit?: numberThe maximum number of items to retrieve. It is important to set this value as very short prefixes will naturally match large numbers of entries.
A number of entries that have the given prefix.
Returns the node at the given prefix.
The prefix.
Protected
_breadthProtected
Perform a breadth-first search starting from the given node and retrieving any entries reachable from that node, until we reach the limit.
The starting node.
The accumulated entries.
The working queue of nodes to search.
Optional
options: { filterEntries?: StringTreeEntryFilter; limit?: number } = {}Optional
filterEntries?: StringTreeEntryFilterA filter function to apply to each candidate entry.
Optional
limit?: numberThe maximum number of entries to retrieve before stopping.
A data structure for quickly retrieving objects by a string prefix. Note that this works well for languages with alphabets (latin, cyrillic, korean, etc.), but may need more nuanced handling for languages that compose characters and letters.