# What is Fuse.js?

Fuse.js is a powerful, lightweight fuzzy-search library, with zero dependencies.

# What is fuzzy searching?

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).

# Why should I use it?

  • With Fuse.js, you don’t need to setup a dedicated backend just to handle search.
  • Simplicity and performance were the main criteria when developing this library.
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
//   }
// ]

# When should I use It?

It might not make sense for every situation, but can be ideal depending on your search requirements. For example:

  • When you want client-side fuzzy searching of small to moderately large data sets.
  • When you can't justify setting up a dedicated backend simply to handle search. ElasticSearch or Algolia, although both great services, may be overkill for your particular use cases.

# Can I still use it on the backend?

Of course! Fuse.js has no DOM dependencies.


Check out the live demo to fiddle with it and to learn how to use it.

# Product of the Week


Notebag is a new experience in note taking, designed from the ground up to be usable from your keyboard. Its fuzzy searching is powered by Fuse.js.