Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.7M
decreased by-7.06%
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

FAQs

Package last updated on 09 Feb 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc