1-based line the character at `index` sits on.
(source: string, index: number)
| 91 | |
| 92 | /** 1-based line the character at `index` sits on. */ |
| 93 | function lineAt(source: string, index: number): number { |
| 94 | let line = 1; |
| 95 | for (let at = 0; at < index && at < source.length; at++) { |
| 96 | if (source[at] === '\n') { |
| 97 | line += 1; |
| 98 | } |
| 99 | } |
| 100 | return line; |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Routes registered in one file. |
no outgoing calls
no test coverage detected