Whether the quote at `i` has an unescaped closing quote on the same line.
(s: string, i: number)
| 420 | |
| 421 | /** Whether the quote at `i` has an unescaped closing quote on the same line. */ |
| 422 | function closesOnLine(s: string, i: number): boolean { |
| 423 | const q = s[i]; |
| 424 | for (let k = i + 1; k < s.length && s[k] !== '\n'; k++) { |
| 425 | if (s[k] === '\\') k++; |
| 426 | else if (s[k] === q) return true; |
| 427 | } |
| 428 | return false; |
| 429 | } |
| 430 | |
| 431 | /** |
| 432 | * The closing `/` of the regex literal the `/` at `i` opens, or -1 when it |