(str)
| 208 | const CONTAINS_ESCAPE = /\\/; |
| 209 | |
| 210 | function unescape(str) { |
| 211 | const needToProcess = CONTAINS_ESCAPE.test(str); |
| 212 | |
| 213 | if (!needToProcess) { |
| 214 | return str; |
| 215 | } |
| 216 | |
| 217 | let ret = ""; |
| 218 | |
| 219 | for (let i = 0; i < str.length; i++) { |
| 220 | if (str[i] === "\\") { |
| 221 | const gobbled = gobbleHex(str.slice(i + 1, i + 7)); |
| 222 | |
| 223 | // eslint-disable-next-line no-undefined |
| 224 | if (gobbled !== undefined) { |
| 225 | ret += gobbled[0]; |
| 226 | i += gobbled[1]; |
| 227 | |
| 228 | // eslint-disable-next-line no-continue |
| 229 | continue; |
| 230 | } |
| 231 | |
| 232 | // Retain a pair of \\ if double escaped `\\\\` |
| 233 | // https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e |
| 234 | if (str[i + 1] === "\\") { |
| 235 | ret += "\\"; |
| 236 | i += 1; |
| 237 | |
| 238 | // eslint-disable-next-line no-continue |
| 239 | continue; |
| 240 | } |
| 241 | |
| 242 | // if \\ is at the end of the string retain it |
| 243 | // https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb |
| 244 | if (str.length === i + 1) { |
| 245 | ret += str[i]; |
| 246 | } |
| 247 | |
| 248 | // eslint-disable-next-line no-continue |
| 249 | continue; |
| 250 | } |
| 251 | |
| 252 | ret += str[i]; |
| 253 | } |
| 254 | |
| 255 | return ret; |
| 256 | } |
| 257 | |
| 258 | function normalizePath(file) { |
| 259 | return path.sep === "\\" ? file.replace(/\\/g, "/") : file; |
no test coverage detected