2.3.4 • Published 5 years ago

open-radix-trie v2.3.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

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
2.3.4

5 years ago

2.3.1

6 years ago

2.2.1

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.1.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago