Skip to content

Commit 687b1e4

Browse files
committed
refactor: change implementation
1 parent df69c33 commit 687b1e4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/matches.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ function matches(
5656
if (matcher instanceof Function) {
5757
return matcher(normalizedText, node)
5858
} else if (matcher instanceof RegExp) {
59-
return new RegExp(matcher).test(normalizedText)
59+
const match = matcher.test(normalizedText)
60+
if (matcher.global) {
61+
matcher.lastIndex = 0
62+
}
63+
return match
6064
} else {
6165
return normalizedText === String(matcher)
6266
}

0 commit comments

Comments
 (0)