Skip to content

Commit 3d1df2a

Browse files
committed
fix: js compatibility
1 parent ec1725b commit 3d1df2a

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/__tests__/util.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ it('extracts dirname', () => {
3333
expect(Util.dirname('abc$$def$', '$')).toBe('abc');
3434

3535
expect(Util.dirname('abc::def:', '::')).toBe('abc');
36+
expect(Util.dirname('abc$`$`def$`$`hij$`klm', '$`')).toBe('abc$`def$`hij');
3637
});
3738

3839
it('extracts extname', () => {

src/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function regexEscape(literal: string) {
1010
*/
1111
function normalizeSeparator(path: string, separator: string) {
1212
const sepRe = new RegExp(`(${regexEscape(separator)}){2,}`, 'g');
13-
return path.replace(sepRe, separator.replaceAll('$', '$$$$'));
13+
return path.replace(sepRe, separator.replace(/\$/g, '$$$$'));
1414
}
1515

1616
/**

0 commit comments

Comments
 (0)