(screen: Screen)
| 301 | } |
| 302 | |
| 303 | export function screenToRows(screen: Screen): string[] { |
| 304 | const rows: string[] = [] |
| 305 | for (let y = 0; y < screen.height; y += 1) { |
| 306 | let row = '' |
| 307 | for (let x = 0; x < screen.width; x += 1) { |
| 308 | row += cellAt(screen, x, y)?.char ?? ' ' |
| 309 | } |
| 310 | rows.push(row) |
| 311 | } |
| 312 | return rows |
| 313 | } |
| 314 | |
| 315 | function normalizeRow(value: string, width: number): string[] { |
| 316 | return [...value.padEnd(width, ' ').slice(0, width)] |
no test coverage detected