refactor(util): code refactor (#13872)

* refactor(util): code refactor

* refactor(util): code refactor
This commit is contained in:
Simon He 2024-06-24 21:13:12 +08:00 • committed by GitHub
parent a61e5aa06b
commit 0de1f0cce4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 10 deletions

View file

@ -274,9 +274,7 @@ export function normalizeConfig(config) {
if (typeof transform === 'function') {
transformers.DEFAULT = transform
}
if (typeof transform === 'object' && transform !== null) {
} else if (typeof transform === 'object' && transform !== null) {
Object.assign(transformers, transform)
}

View file

@ -15,8 +15,7 @@ export function parseGlob(pattern) {
if (glob.substr(0, 2) === './') {
glob = glob.substr(2)
}
if (glob.charAt(0) === '/') {
} else if (glob.charAt(0) === '/') {
glob = glob.substr(1)
}

View file

@ -29,11 +29,7 @@ export function splitAtTopLevelOnly(input, separator) {
}
}
if (isEscaped) {
isEscaped = false
} else if (char === '\\') {
isEscaped = true
}
isEscaped = isEscaped ? false : char === '\\'
if (char === '(' || char === '[' || char === '{') {
stack.push(char)