(text: string)
| 220 | } |
| 221 | |
| 222 | function leftAlign(text: string): string { |
| 223 | let indent = Number.MAX_VALUE; |
| 224 | |
| 225 | const lines = text.split('\n'); |
| 226 | lines.forEach((line) => { |
| 227 | const lineIndent = line.search(/\S/); |
| 228 | if (lineIndent !== -1) { |
| 229 | indent = Math.min(lineIndent, indent); |
| 230 | } |
| 231 | }); |
| 232 | |
| 233 | return lines |
| 234 | .map((line) => line.substr(indent)) |
| 235 | .join('\n') |
| 236 | .trim(); |
| 237 | } |
no test coverage detected