Fuzzysearch
:crystal_ball: Tiny and blazing-fast fuzzy search in JavaScript
Install / Use
npx skills add bevacqua/fuzzysearchInstalls into whichever agent you are using.
README
fuzzysearch
Tiny and blazing-fast fuzzy search in JavaScript
Fuzzy searching allows for flexibly matching a string with partial input, useful for filtering data very quickly based on lightweight user input.
Demo
To see fuzzysearch in action, head over to bevacqua.github.io/horsey, which is a demo of an autocomplete component that uses fuzzysearch to filter out results based on user input.
Install
From npm
npm install --save fuzzysearch
fuzzysearch(needle, haystack)
Returns true if needle matches haystack using a fuzzy-searching algorithm. Note that this program doesn't implement levenshtein distance, but rather a simplified version where there's no approximation. The method will return true only if each character in the needle can be found in the haystack and occurs after the preceding matches.
fuzzysearch('twl', 'cartwheel') // <- true
fuzzysearch('cart', 'cartwheel') // <- true
fuzzysearch('cw', 'cartwheel') // <- true
fuzzysearch('ee', 'cartwheel') // <- true
fuzzysearch('art', 'cartwheel') // <- true
fuzzysearch('eeel', 'cartwheel') // <- false
fuzzysearch('dog', 'cartwheel') // <- false
An exciting application for this kind of algorithm is to filter options from an autocomplete menu, check out horsey for an example on how that might look like.
But! RegExps...!
<sub>The current implementation uses the algorithm suggested by Mr. Aleph, a crazy russian compiler engineer working at V8.</sub>
License
MIT
Related Skills
node-connect
385.5kDiagnose OpenClaw Android, iOS, or macOS node pairing, QR/setup code, route, auth, and connection failures.
blender-python-addon
40.5kBlender Python add-on rules for operators, panels, properties, registration, testing, and API-safe scripting
flutter-development-guidelines-cursorrules-prompt-file
40.5kCursor rules for Flutter development with MVVM architecture, Riverpod state management, Material widgets, and Dart style guidelines.
commit-push-pr
140.6kCommit, push, and open a PR

