fuzzy logic code javascript code example
Example 1: fuzzy search javascript
// This can be excluded when loaded via <script>import FuzzySearch from 'fuzzy-search'; // Or: var FuzzySearch = require('fuzzy-search'); const people = [{ name: { firstName: 'Jesse', lastName: 'Bowen', }, state: 'Seattle',}]; const searcher = new FuzzySearch(people, ['name.firstName', 'state'], { caseSensitive: true,});const result = searcher.search('ess');
Example 2: javascript fuzzy search
const options = {
includeScore: true,
// Search in `author` and in `tags` array
keys: ['author', 'tags']
}
const fuse = new Fuse(list, options)
const result = fuse.search('tion')