Private
#rootThe tree's root.
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: { Additional options to configure behaviour.
The 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 filter function to apply to each candidate entry.
A number of entries that have the given 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: { The maximum number of entries to retrieve before stopping.
A filter function to apply to each candidate entry.
Private
#create
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.