-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
22 deletions.
There are no files selected for viewing
11 changes: 9 additions & 2 deletions
11
src/config/normalize/lib/wild_wild_path/parsing/normalize.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
// Escaping character | ||
export const ESCAPE = '\\' | ||
|
||
// Paths separator. | ||
// We squash multiple ones in a row. | ||
// But we do not trim spaces at the start or end to allow root paths. | ||
export const PATH_SEPARATOR = ' ' | ||
export const PATH_SEPARATOR_NAME = 'a space' | ||
|
||
// Tokens separator | ||
export const TOKEN_SEPARATOR = '.' | ||
|
||
// Special characters to escape | ||
export const SPECIAL_CHARS = new Set([ESCAPE, TOKEN_SEPARATOR]) | ||
export const SPECIAL_CHARS = new Set([ESCAPE, TOKEN_SEPARATOR, PATH_SEPARATOR]) | ||
|
||
// Escape special characters | ||
export const escapeSpecialChars = function (string) { | ||
return string.replace(SPECIAL_CHARS_REGEXP, `${ESCAPE}$&`) | ||
} | ||
|
||
const SPECIAL_CHARS_REGEXP = /[\\.]/gu | ||
const SPECIAL_CHARS_REGEXP = /[\\. ]/gu |