Get started with list.fuzzysearch.js CDN
Apache-2.0 licensed
List.fuzzysearch.js is a lightweight library for performing fuzzy searches on arrays.
Tags:- fuzzy
- search
- list.js
- list
Stable version
Copied!
How to start using list.fuzzysearch.js CDN
// Include the library from the CDN
const Fuse = require('https://cdn.cdnhub.io/list.fuzzysearch.js/0.1.0/list.fuzzysearch.min.js');
// Create a new Fuse instance with an array of items and a key to search
const fuse = new Fuse(['Apple', 'Banana', 'Cherry', 'Date', 'Elderberry'], {
keys: ['item'] // 'item' is the property name to search in each object
});
// Perform a search and get the results
const results = fuse.search('App');
console.log(results); // Output: [ { item: 'Apple', fuzzyScore: 100 } ]
// Update the DOM with the search results
const list = document.getElementById('fruit-list');
results.forEach(item => {
const li = document.createElement('li');
li.textContent = item.item;
list.appendChild(li);
});
Copied!
Copied!