Fuzzy Search with fuse.js demo

node v10.24.1
version: 1.0.0
endpointsharetweet
const Fetch = require('node-fetch'); const Fuse = require('fuse.js'); const fruits = [ { name: "Apple", color: "red" }, { name: "Orange", color: "orange" }, { name: "Banana", color: "yellow" } ] const options = { isCaseSensitive: false, findAllMatches: true, includeMatches: false, includeScore: true, useExtendedSearch: false, threshold: 0.4, location: 0, distance: 2, maxPatternLength: 32, minMatchCharLength: 2, keys: ["name"] }; const fuse = new Fuse(fruits, options) let input = "banna" let result = fuse.search(input) console.log(result)
Loading…

no comments

    sign in to comment