1.0.2-s • Published 4 years ago

termgen v1.0.2-s

Weekly downloads
2
License
GPL-3.0
Repository
github
Last release
4 years ago

Termgen

An implementation of an autocompletion library in JavaScript

Usage

You can install the packing using NPM

npm install termgen --save

or Yarn

yarn add termgen

Example

import { Agent } from "termgen";

const agent = new Agent();

// index all search terms
agent.recognize("dogs", 1);
agent.recognize("fish", 2);
agent.recognize("fisherman", 3);

// search for autocompletions
const { query, result } = agent.query("fis");
console.log(result); // [{ key: "fish", data: 2 }, { key: "fisherman", data: 3 }]