Files
Guangyue Xu f99b6ceb60 update postcss package and nanoid package
This change updated the postcss package from 8.4.5 to 8.4.38 and the dependent package nanoid package from 3.1.30 to 3.3.7 to fix the vulnerability related to the two packages.

I have to use the `npm audit fix --force` to update the two packages instead of `npm run install-deps audit-fix --audit-level=critical` due to an error tracked in https://issues.chromium.org/issues/343248814


Bug: 343248812
Change-Id: I5e8a8b7a0515d3610ac2ab5f999f99fed8893da0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5577438
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2024-05-29 06:47:46 +00:00

59 lines
1.2 KiB
JavaScript

'use strict'
let list = {
comma(string) {
return list.split(string, [','], true)
},
space(string) {
let spaces = [' ', '\n', '\t']
return list.split(string, spaces)
},
split(string, separators, last) {
let array = []
let current = ''
let split = false
let func = 0
let inQuote = false
let prevQuote = ''
let escape = false
for (let letter of string) {
if (escape) {
escape = false
} else if (letter === '\\') {
escape = true
} else if (inQuote) {
if (letter === prevQuote) {
inQuote = false
}
} else if (letter === '"' || letter === "'") {
inQuote = true
prevQuote = letter
} else if (letter === '(') {
func += 1
} else if (letter === ')') {
if (func > 0) func -= 1
} else if (func === 0) {
if (separators.includes(letter)) split = true
}
if (split) {
if (current !== '') array.push(current.trim())
current = ''
split = false
} else {
current += letter
}
}
if (last || current !== '') array.push(current.trim())
return array
}
}
module.exports = list
list.default = list