* Get the character index of the start of a line
(lineNumber: number)
| 534 | * Get the character index of the start of a line |
| 535 | */ |
| 536 | private getLineStart(lineNumber: number): number { |
| 537 | const starts = this.lineStarts(); |
| 538 | const line = Math.ceil(lineNumber) - 1; |
| 539 | if (!(line > 0)) return 0; |
| 540 | // Past the last line: where a line after it would start. |
| 541 | return line < starts.length ? starts[line]! : this.source.length + 1; |
| 542 | } |
| 543 | |
| 544 | /** |
| 545 | * Where each line of the source starts, read once. Both lookups above read |
no test coverage detected