(str: string)
| 393 | * @public |
| 394 | */ |
| 395 | export function isQuotedString(str: string): boolean { |
| 396 | // quickly return false if the value is note quoted |
| 397 | if (str[0] !== '"' && str[0] !== "'") return false |
| 398 | if (str[0] !== str[str.length - 1]) return false |
| 399 | const quoteType = str[0] |
| 400 | for (let p = 1; p < str.length; p++) { |
| 401 | if ( |
| 402 | str[p] === quoteType && |
| 403 | (p === 1 || str[p - 1] !== '\\') && |
| 404 | p !== str.length - 1 |
| 405 | ) { |
| 406 | return false |
| 407 | } |
| 408 | } |
| 409 | return true |
| 410 | } |
| 411 | |
| 412 | /** |
| 413 | * Remove extra escape characters. |
no outgoing calls
no test coverage detected