finds.dev← search

// the find

bevacqua/fuzzysearch

★ 2,744 · JavaScript · MIT · updated May 2023

:crystal_ball: Tiny and blazing-fast fuzzy search in JavaScript

A single-function JavaScript library that checks whether one string is a subsequence of another — every character in the needle appears in the haystack in order, but not necessarily contiguously. It is not fuzzy search in the Levenshtein sense; it is subsequence matching. Good for autocomplete filters where you want 'twl' to match 'cartwheel'.

The implementation is genuinely tiny — the entire thing is one loop in index.js, no dependencies, no build step. Subsequence matching is fast in practice for autocomplete because you bail early on mismatch. The README is honest about what the algorithm is and is not, which is more than most micro-libraries manage. MIT licensed, works in any JS environment.

Last meaningful commit is from 2015; the 2023 touch was likely a metadata bump. No ranking or scoring — you get a boolean, so filtering a list of 500 options gives you no way to sort 'cart' above 'cw' as a match for 'cartwheel'. The algorithm has no tolerance for transpositions or typos, so a mistyped character gives zero match where a user expects partial credit. At this point there are maintained alternatives (fuse.js, uFuzzy) that do ranking and have kept up with the ecosystem.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →