bevacqua/fuzzysearch
bevacqua/fuzzysearch has 2,739 GitHub stars and 84 forks. GitHot measured 0 stars in 24 hours, -1 in 7 days, and -1 in 15 days. Last checked 2026-11-23 05:03 UTC. Last push 2023-05-31.
实测星标增长
- 24小时
- 0
- 7天
- -1
- 15天
- -1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
关于
:crystal_ball: 体积小巧、速度极快的 JavaScript 模糊搜索
开发工具README.md
原文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...!
The current implementation uses the algorithm suggested by Mr. Aleph, a crazy russian compiler engineer working at V8.
License
MIT
探索相关项目
加载中…
