deno.land / x / fuse@v6.4.1 / docs
noGlobalSocialShare: true shareTitle: Fuse.js - JavaScript fuzzy-search library
Fuse.js is a powerful, lightweight fuzzy-search library, with zero dependencies.
Generally speaking, fuzzy searching (more formally known as approximate string matching) is the technique of finding strings that are approximately equal to a given pattern (rather than exactly).
::: details As easy as 1, 2, 3
// 1. List of items to search in
const books = [
{
title: "Old Man's War",
author: {
firstName: 'John',
lastName: 'Scalzi'
}
},
{
title: 'The Lock Artist',
author: {
firstName: 'Steve',
lastName: 'Hamilton'
}
}
]
// 2. Set up the Fuse instance
const fuse = new Fuse(books, {
keys: ['title', 'author.firstName']
})
// 3. Now search!
fuse.search('jon')
// Output:
// [
// {
// item: {
// title: "Old Man's War",
// author: {
// firstName: 'John',
// lastName: 'Scalzi'
// }
// },
// refIndex: 0
// }
// ]
:::
It might not make sense for every situation, but can be ideal depending on your search requirements. For example:
Of course! Fuse.js has no DOM dependencies.
Plenty of people. It's hard to say an exact number, since it's free. But a good indication is the number of dependents on NPM, and the dependency graph and stargazers on Github.
Read the stories to learn how various products are using Fuse.js to tackle a growing number of use cases.
Check out the live demo to fiddle with it and to learn how to use it.
Version Info