Fix the mechanical style rules. [skip build]
This commit is contained in:
@@ -85,13 +85,13 @@ export function fuzzyMatchAny(
|
||||
texts: Array<string | undefined | null>,
|
||||
): FuzzyMatch | null {
|
||||
let best: FuzzyMatch | null = null;
|
||||
for (const text of texts) {
|
||||
if (!text) continue;
|
||||
texts.forEach((text) => {
|
||||
if (!text) return;
|
||||
const match = fuzzyMatch(query, text);
|
||||
if (match && (!best || match.score > best.score)) {
|
||||
best = match;
|
||||
}
|
||||
}
|
||||
});
|
||||
return best;
|
||||
}
|
||||
|
||||
@@ -106,12 +106,12 @@ export function fuzzyFilter<T>(
|
||||
}
|
||||
|
||||
const results: Array<{ item: T; score: number }> = [];
|
||||
for (const item of items) {
|
||||
items.forEach((item) => {
|
||||
const match = fuzzyMatchAny(q, getTexts(item));
|
||||
if (match) {
|
||||
results.push({ item, score: match.score });
|
||||
}
|
||||
}
|
||||
});
|
||||
results.sort((a, b) => b.score - a.score);
|
||||
return results;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user