2.3.4 • Published 7 years ago
open-radix-trie v2.3.4
open-radix-trie
Radix trie implementation with partial lookups and extensible paths.
Usage
import { OpenRadixTrie } from 'open-radix-trie'API
OpenRadixTrie
class OpenRadixTrie<
TValue,
TContext extends Record<keyof TContext, ExtensiblePathComponentMaker> = any
>A radix trie that matches the largest prefix of a string that matches its nodes.
xerpath is used for routing.
set
(path: ExtensiblePath<TContext> | string, value: TValue | undefined): voidInserts, updates, or deletes the value of the data structure at the specified path.
Note that no two custom matchers are considered equal and will always result in an insertion.
Parameters:
- path - The path to update.
- value - The value. If
undefined, the value is removed from the data structure.
get
(path: string): { value: TValue | undefined; args: any[]; remainingPath: string }Gets the value of the data structure at the specified path.
Parameters:
- path
buildPath
(path: ExtensiblePath<TContext> | string): (string | ExtensiblePathComponent)[]delete
(path: ExtensiblePath<TContext> | string): booleanentries, Symbol.iterator
(): IterableIterator<[(string | ExtensiblePathComponent)[], TValue]>keys
(): IterableIterator<(string | ExtensiblePathComponent)[]>values
(): IterableIterator<TValue>clear
(): voidforEach
(callbackFn: (value: TValue, key: (string | ExtensiblePathComponent)[], trie: this) => void, thisArg?: any)has
(path: string): boolean