Installation • Usage • Contributors • License
yarn add refined-text-search
import { tokenize, match } from 'refined-text-search'
// Tokenize a search query
const tokens = tokenize('"Hello World" my dear -"how are you" -horrible oh')
// -> [
// {term: 'how are you', exclude: true},
// {term: 'horrible', exclude: true},
// {term: 'hello world'},
// {term: 'my'},
// {term: 'dear'},
// {term: 'oh'}
// ]
// See if a tokenized query matches a string
const b = match(tokens, 'HeLLo World. My dear oh dear...')
// -> true
const b = match(tokens, 'HeLLo World.')
// -> false
const c = match(tokens, 'HeLLo World. My dear oh dear... What a horrible night.')
// -> false
Thanks goes to these wonderful people (emoji key):
David Reeß 💻 📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!
MIT