Skip to content

Commit 29024cd

Browse files
committed
escape only dots
1 parent 161ce55 commit 29024cd

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/utils.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,10 @@ export function conditions(options: t.Options): Set<t.Condition> {
1919
return out;
2020
}
2121

22-
const regexSyntaxCharacters = '^$\\.*+?()[]{}|/'.split('');
23-
const regexSyntaxCharactersRegExp = new RegExp(`[${regexSyntaxCharacters.map((char) => `\\${char}`).join('')}]`, 'g');
24-
2522
/**
2623
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/escape
2724
*/
28-
const regExpEscape = (raw: string) => raw.replace(regexSyntaxCharactersRegExp, '\\$&');
25+
const regExpEscape = (raw: string) => raw.replace(/\./g, '\\$&');
2926

3027
export function walk(name: string, mapping: Mapping, input: string, options?: t.Options): string[] {
3128
let entry = toEntry(name, input);

0 commit comments

Comments
 (0)