(s: string, i: number)
| 434 | |
| 435 | /** Whether the quote at `i` has an unescaped closing quote on the same line. */ |
| 436 | export function closesOnLine(s: string, i: number): boolean { |
| 437 | const q = s[i]; |
| 438 | for (let k = i + 1; k < s.length && s[k] !== '\n'; k++) { |
| 439 | if (s[k] === '\\') k++; |
| 440 | else if (s[k] === q) return true; |
| 441 | } |
| 442 | return false; |
| 443 | } |
| 444 | |
| 445 | /** |
| 446 | * The closing `/` of the regex literal the `/` at `i` opens, or -1 when it |