Pārlūkot izejas kodu

Adds support for quoted prefix/suffix in tokens

main
Eric Amodio pirms 5 gadiem
vecāks
revīzija
9044982bc4
1 mainītis faili ar 6 papildinājumiem un 3 dzēšanām
  1. +6
    -3
      src/system/string.ts

+ 6
- 3
src/system/string.ts Parādīt failu

@ -62,8 +62,8 @@ export namespace Strings {
const driveLetterNormalizeRegex = /(?<=^\/?)([A-Z])(?=:\/)/;
const pathNormalizeRegex = /\\/g;
const pathStripTrailingSlashRegex = /\/$/g;
const tokenRegex = /\$\{(\W*)?([^|]*?)(?:\|(\d+)(-|\?)?)?(\W*)?\}/g;
const tokenSanitizeRegex = /\$\{(?:\W*)?(\w*?)(?:[\W\d]*)\}/g;
const tokenRegex = /\$\{(".*?"|\W*)?([^|]*?)(?:\|(\d+)(-|\?)?)?(".*?"|\W*)?\}/g;
const tokenSanitizeRegex = /\$\{(?:".*?"|\W*)?(\w*?)(?:".*?"|[\W\d]*)\}/g;
// eslint-disable-next-line no-template-curly-in-string
const tokenSanitizeReplacement = '$${this.$1}';
@ -89,7 +89,10 @@ export namespace Strings {
options: {
collapseWhitespace: option === '?',
padDirection: option === '-' ? 'left' : 'right',
prefix: prefix,
prefix:
prefix?.length > 1 && prefix?.startsWith('"') && prefix?.endsWith('"')
? prefix.substr(1, prefix.length - 2)
: prefix,
suffix: suffix,
truncateTo: truncateTo == null ? undefined : parseInt(truncateTo, 10)
}

Notiek ielāde…
Atcelt
Saglabāt