* Formats user code with dashes for readability * e.g., "ABCDEFGH" -> "ABCD-EFGH"
(code: string)
| 369 | * e.g., "ABCDEFGH" -> "ABCD-EFGH" |
| 370 | */ |
| 371 | private formatUserCode(code: string): string { |
| 372 | // If code already has dashes, return as-is |
| 373 | if (code.includes("-")) { |
| 374 | return code; |
| 375 | } |
| 376 | |
| 377 | // Insert dash in middle for codes without formatting |
| 378 | const mid = Math.floor(code.length / 2); |
| 379 | return code.slice(0, mid) + "-" + code.slice(mid); |
| 380 | } |
| 381 | |
| 382 | /** |
| 383 | * Gets human-readable time remaining |