fuzzy-ranking
Installation
SKILL.md
Setup
import { compareItems, rankItem, rankings } from '@tanstack/match-sorter-utils'
const query = 'tan'
const values = ['table', 'tanner', 'router']
export const ranked = values
.map((value) => ({
value,
info: rankItem(value, query, { threshold: rankings.MATCHES }),
}))
.filter((entry) => entry.info.passed)
.sort((a, b) => compareItems(a.info, b.info))