MCPcopy
hub / github.com/codeaashu/claude-code / fuzzyMatch

Function fuzzyMatch

web/components/command-palette/CommandPalette.tsx:13–22  ·  view source on GitHub ↗

Fuzzy match: every character of query must appear in order in target

(target: string, query: string)

Source from the content-addressed store, hash-verified

11
12/** Fuzzy match: every character of query must appear in order in target */
13function fuzzyMatch(target: string, query: string): boolean {
14 if (!query) return true;
15 const t = target.toLowerCase();
16 const q = query.toLowerCase();
17 let qi = 0;
18 for (let i = 0; i < t.length && qi < q.length; i++) {
19 if (t[i] === q[qi]) qi++;
20 }
21 return qi === q.length;
22}
23
24/** Score a command against a search query (higher = better) */
25function score(cmd: Command, query: string): number {

Callers 1

scoreFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected