Release 0.6.0
·
63 commits
to main
since this release
Added
-
Add builtin fuzzy search and sort algorithm. Use as default for filtering in
createOptions. This replaces the previous filtering logic that could only
match exact segments and was case sensitive. The new algorithm is case
insensitive, can match multiple partials and prioritises start of string /
start of word / consecutive matches. When sorting, if two matches have the
same score then their original array index is used as the tiebreaker.sorted = fuzzySort("spp", ["pineapple", "rose apple", "star apple"]) // [{ target: "star apple", ... }, { target: "rose apple", ... }]
A helper to highlight matches is also included:
highlighted = fuzzyHighlight(sorted[0]) // <><mark>s</mark>tar a<mark>pp</mark>le</>
Changed
- Mark package as side effect free.