(code: string)
| 161 | } |
| 162 | |
| 163 | function getLongestLineIndex(code: string) { |
| 164 | const newlineRe = /\r\n|\r|\n/; |
| 165 | const lines = code.split(newlineRe); |
| 166 | |
| 167 | let longest = 0; |
| 168 | lines.forEach((line, i) => { |
| 169 | if (lines[longest].length < line.length) { |
| 170 | longest = i; |
| 171 | } |
| 172 | }); |
| 173 | |
| 174 | return longest; |
| 175 | } |