# prefix-trie-ts

> Create and modify trie prefix structures, extract word lists including anagrams and sub-anagrams

Latest version **0.0.4** (published 2018-03-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install prefix-trie-ts
pnpm add prefix-trie-ts
yarn add prefix-trie-ts
bun add prefix-trie-ts
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2018-03-30 |
| First published | 2017-04-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 27.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Scott Lott, Lyndsey Browning |
| Maintainers | clicksimply |
| Keywords | javascript, trie, words, prefix-trie, tree, prefix, autocomplete |

## Links

- npm: https://www.npmjs.com/package/prefix-trie-ts
- Repository: https://github.com/ClickSimply/prefix-trie-ts
- Homepage: https://github.com/ClickSimply/prefix-trie-ts#readme
- Issues: https://github.com/ClickSimply/prefix-trie-ts/issues
- npm.io page: https://npm.io/package/prefix-trie-ts

## Recent versions

- 0.0.4 (latest) — 2018-03-30
- 0.0.3 — 2017-12-23
- 0.0.2 — 2017-04-17
- 0.0.1 — 2017-04-11

## README

# Prefix Trie TS

Smallest possible Trie implimintation written in Typescript.

## Features
- Prefix trie for autocomplete.
- Less than 800 bytes gzipped.
- Full typescript support.
- Trie is not case sensitive.

## Installation

`npm i prefix-trie-ts`

### Browser
- Include `dist/prefixTrie.min.js` on your page with a `script` tag.

### NodeJS
```js
const Trie = requie("prefix-trie-ts").Trie;
```

### Typescript
```js
import { Trie } from "prefix-trie-ts";
```

## Usage

```js
var trie = new Trie(["scott","jeb"]);
trie.addWord("john");
console.log(trie.getPrefix("j")) // <= ["john","jeb"]
```

## Methods

### Constructor
Optionally pass in the list of strings to search.
```js
var trie = new Trie(["name1","name2"...])
```

### Add Word
Add a word to the trie.
```js
trie.addWord("name3");
```

### Remove Word
Remove a word from the trie.
```js
trie.removeWord("name3");
```

### Get All Words
List all words in the word list.
```js
trie.getWords()
```

### Get Prefix
Search the trie for all words that begin with or match a given string. Returns an array of found strings.
```js
trie.getPrefix("jo")
```

### Export Trie Index
```js
let exported = trie.getIndex();
```

### Import Trie Index
```js
trie.setIndex(indexJSON);
```

---
_Source: https://npm.io/package/prefix-trie-ts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
