Isearch
Fast expression matching for term lists. Search and filter.
Installation
npm install properjs-isearch --save-dev
Usage
var Isearch = require( "properjs-isearch" );
// Array of terms, could be from a request
var terms = ["foo", "bar", "baz", "bot"];
var input = document.getElementById( "myInput" );
// Init isearch with this term catalogue
var isearch = new Isearch({
terms: terms
});
// Compare user input against terms
input.addEventListener( "keyup", function () {
isearch.query( this.value, function ( matches ) {
// Do stuff with matches here
});
}, false );
Options
- terms
- escapeInputs
- matchFront
- matchCase
- alphaResults
- processMatches( regex )
- Provide a unique method to match items in different ways