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

@trie-data-structure/uncompressed-trie

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trie-data-structure/uncompressed-trie

Trie data structures for JavaScript

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

:chains: @trie-data-structure/uncompressed-trie

Trie data structures for JavaScript. See docs.

:warning: Depending on your environment, the code may require regeneratorRuntime to be defined, for instance by importing regenerator-runtime/runtime.

import {Trie, ArrayNode} from '@trie-data-structure/uncompressed-trie';
import {range} from '@iterable-iterator/range';
import {map} from '@iterable-iterator/map';

const encode = (key) => map((i) => key.charCodeAt(i), range(key.length));
const degree = 256;
const trie = new Trie(new ArrayNode(degree));

const set = (key, value) => trie.set(encode(key), value);
const get = (key) => trie.get(encode(key));

set('abra', 1);
set('cadabra', 2);
set('abracadabra', 3);

get('abra'); // 1
get('cadabra'); // 2
get('abracadabra'); // 3

License Version Tests Dependencies Dev dependencies GitHub issues Downloads

Code issues Code maintainability Code coverage (cov) Code technical debt Documentation Package size

Keywords

FAQs

Package last updated on 19 Dec 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