Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 704 Bytes

README.md

File metadata and controls

39 lines (26 loc) · 704 Bytes

JS_TRGM

Match text using trigrams in Javascript, similar to Postgres' pg_trgm extension.

Installation

npm i js-trgm --save

Usage

import { similarity, trgm_search } from 'js-trgm';

const string1 = 'Hello Word';
const string2 = 'Hello World';
const coll1 = ['Hello World', 'Something else', 'Something else entirely'];

console.log(similarity(string1, string2));
console.log(trgm_search(string1, coll1));

Developing

Once you've created a project and installed dependencies with pnpm install, start a development server:

pnpm dev

# or start the server and open the demo in a new browser tab
pnpm dev -- --open

Packaging

pnpm package