JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q45490F
  • License MIT

Radix trie implementation with partial lookups and extensible paths.

Package Exports

  • open-radix-trie

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (open-radix-trie) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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): void

Inserts, 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): boolean

entries, Symbol.iterator

(): IterableIterator<[(string | ExtensiblePathComponent)[], TValue]>

keys

(): IterableIterator<(string | ExtensiblePathComponent)[]>

values

(): IterableIterator<TValue>

clear

(): void

forEach

(callbackFn: (value: TValue, key: (string | ExtensiblePathComponent)[], trie: this) => void, thisArg?: any)

has

(path: string): boolean