trie-js

WebJar for trie-js

License

License

MIT
Categories

Categories

JavaScript Languages
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

trie-js
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

trie-js
WebJar for trie-js
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/ejlangev/trie-js

Download trie-js

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/trie-js/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>trie-js</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/trie-js/
implementation 'org.webjars.npm:trie-js:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/trie-js/
implementation ("org.webjars.npm:trie-js:1.0.0")
'org.webjars.npm:trie-js:jar:1.0.0'
<dependency org="org.webjars.npm" name="trie-js" rev="1.0.0">
  <artifact name="trie-js" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='trie-js', version='1.0.0')
)
libraryDependencies += "org.webjars.npm" % "trie-js" % "1.0.0"
[org.webjars.npm/trie-js "1.0.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

trie-js

Javascript implementation of a Trie with customizable delimiters designed for use with the node environment.

Build Status

Installing

npm install trie-js

Creating a trie

// empty Trie with default delimiter
const trie = new Trie();

// trie with some initial values
const trie = new Trie(['abc', 'def']);

// trie with some initial values that are also iterable
const trie = new Trie([['a', 'b', 'c'], ['a', 'b', 'd']]);

// trie with custom object implementing iterator
const obj1 = {
  [Symbol.iterator]: function*() {
    yield 'a';
    yield 'b';
    yield 'd'
  }
}

const trie = new Trie([obj1]);

Adding, removing, and testing for values

const trie = new Trie();

// Adding is chainable
trie.add('abc')
  .add('def')
  .add('ghi');

// Removing is chainable
trie.remove('abc')
  .remove('def');

trie.lookup('abc') // false
trie.lookup('ghi') // true

Checking for prefixes

const trie = new Trie(['abc', 'def']);

trie.isPrefix('ab') // true
trie.isPrefix('abc') // false

Versions

Version
1.0.0