0.3.0 • Published 4 years ago

js-trie v0.3.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

JS Trie

A typescript implementation of the Prefix Trie data structure.

Build Status Coverage Status npm version

  • Installation
  • Usage
  • API

Installation

npm i js-trie --save

Usage

const { Trie } = require('js-trie');

let trie = new Trie();

trie.insert("apple");
trie.search("apple");   // returns true
trie.search("app");     // returns false
trie.startsWith("app"); // returns true
trie.insert("app");   
trie.search("app");     // returns true

API

The library exposes the following functions:

  • insert(word : string) : void

Inserts an word into the prefix trie

  • search(word : string) : boolean

Returns true if the word exists in the prefix trie, otherwise false.

  • startsWith(prefix : string) : boolean

Returns true if there exists a word that starts with part, otherwise false.

0.3.0

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago