🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@wry/trie

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wry/trie

https://en.wikipedia.org/wiki/Trie

0.5.0
next
latest
Source
npm
Version published
Weekly downloads
4.8M
-0.34%
Maintainers
1
Weekly downloads
 
Created

What is @wry/trie?

The @wry/trie package is a library for creating and manipulating trie data structures in JavaScript. A trie, also known as a prefix tree, is a type of search tree that is used to store a dynamic set or associative array where the keys are usually strings. It is particularly useful for tasks like autocomplete, spell checking, and prefix matching.

What are @wry/trie's main functionalities?

Creating a Trie

This feature allows you to create a new Trie instance and insert strings into it. You can then find all strings that start with a given prefix.

{"import { Trie } from '@wry/trie';

const trie = new Trie();
trie.insert('hello');
trie.insert('world');
trie.insert('help');

console.log(trie.find('hel')); // ['hello', 'help']
console.log(trie.find('world')); // ['world']"}

Checking for Existence

This feature allows you to check if a particular string exists in the trie.

{"import { Trie } from '@wry/trie';

const trie = new Trie();
trie.insert('hello');
trie.insert('world');

console.log(trie.has('hello')); // true
console.log(trie.has('bye')); // false"}

Removing Entries

This feature allows you to remove entries from the trie.

{"import { Trie } from '@wry/trie';

const trie = new Trie();
trie.insert('hello');
trie.insert('world');
trie.remove('hello');

console.log(trie.has('hello')); // false
console.log(trie.has('world')); // true"}

Other packages similar to @wry/trie

Keywords

trie

FAQs

Package last updated on 24 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts