We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6e88205 commit af5e7f7Copy full SHA for af5e7f7
src/App.tsx
@@ -32,7 +32,11 @@ function escapeRegExp(str: string) {
32
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
33
}
34
35
-function fuzzyMatch(pattern: string, str: string) {
+function fuzzyMatch(pattern: string, text: string) {
36
+ // NOTE: ignore case
37
+ pattern = pattern.toLowerCase();
38
+ text = text.toLowerCase();
39
+
40
pattern =
41
".*" +
42
pattern
@@ -42,7 +46,7 @@ function fuzzyMatch(pattern: string, str: string) {
46
.map((l: string) => `${escapeRegExp(l)}.*`)
43
47
.join("");
44
48
const re = new RegExp(pattern);
45
- return re.test(str);
49
+ return re.test(text);
50
51
52
// 通用类型定义
0 commit comments