How to do fuzzy search with JavaScript?

Sometimes, we want to do fuzzy search with JavaScript.

In this article, we’ll look at how to do fuzzy search with JavaScript.

How to do fuzzy search with JavaScript?

To do fuzzy search with JavaScript, we use the fuzzaldrin library.

To install it, we run

npm install fuzzaldrin

Then we use it by writing

const fuzzaldrin = require("fuzzaldrin");
const matches = fuzzaldrin.filter(["international", "splint", "tinder"], "int");

to call fuzzaldrin.filter with an array of possible matches and the search string we’re searching with.

Then filter returns an array of fuzzy search matches for searching for matches for 'int' in ["international", "splint", "tinder"].

Conclusion

To do fuzzy search with JavaScript, we use the fuzzaldrin library.