Skip to content

Commit 7d34c9f

Browse files
committed
refactor: self code review
1 parent 41a1226 commit 7d34c9f

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ buck-out/
3232
lib/
3333

3434
/.idea
35+
coverage/

Diff for: src/utils.ts

-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { RegexElement } from './types';
2-
31
/**
42
* Wraps regex string in a non-capturing group if it is more than one character long.
53
*
@@ -10,18 +8,6 @@ export function wrapGroup(regex: string): string {
108
return regex.length === 1 ? regex : `(?:${regex})`;
119
}
1210

13-
export function needsGrouping(element: RegexElement) {
14-
if (typeof element === 'string') {
15-
return element.length > 1;
16-
}
17-
18-
if (element.type === 'characterClass') {
19-
return false;
20-
}
21-
22-
return true;
23-
}
24-
2511
export function escapeText(text: string) {
2612
return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
2713
}

0 commit comments

Comments
 (0)