Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

quick-trie

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quick-trie

Trie implementation for node and js projects

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Quick Trie Build Status codecov Known Vulnerabilities semantic-release

Trie implementation for faster searches

Trie

A trie structure an efficient way to match strings. It's worst computational complexity is O(N) where N is the length of the key.

For this reason trie search is commonly used in routing algorithms on web servers.

Features

  • Pattern matching in linear time
  • Efficient String Searching
  • Static Typing

Get Started

Install

yarn add quick-trie

Simple Usage

By default, key matching are case insensitive.

const root = init<number>();
add(root, 'foo', 1);

console.log(get(root, 'foo')); // 1
console.log(get(root, 'FOO')); // 1

To disable ignore casing, simply pass config object to the init function

const root = init<number>({
  ignoreCasing: false,
});
add(root, 'foo', 1);

console.log(get(root, 'foo')); // 1
console.log(get(root, 'FOO')); // undefined

Search String

const root = init<number>();
add(root, 'hello world', 1);
add(root, 'world class', 2);

console.log(search(root, 'world'));
[1, 2];
console.log(search(root, 'hello'));
[1];
console.log(search(root, 'class'));
[2];

FAQs

Package last updated on 02 May 2020

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