(content: string)
| 141 | * dropped per line so it does not render as a stray glyph. |
| 142 | */ |
| 143 | export function splitLines(content: string): string[] { |
| 144 | const lines = content.split('\n'); |
| 145 | for (let i = 0; i < lines.length; i++) { |
| 146 | const line = lines[i] as string; |
| 147 | if (line.endsWith('\r')) lines[i] = line.slice(0, -1); |
| 148 | } |
| 149 | // A file ending in a newline splits to a final empty string that is not a |
| 150 | // line of source. Every other trailing empty line IS one. |
| 151 | if (lines.length > 1 && lines[lines.length - 1] === '') lines.pop(); |
| 152 | return lines; |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * The whole text of an INDEXED file, or `null` for anything unreadable. |
no outgoing calls
no test coverage detected