Format a millisecond duration as a human-readable string (e.g. "5m 30s").
(ms: number)
| 6 | |
| 7 | /** Format a millisecond duration as a human-readable string (e.g. "5m 30s"). */ |
| 8 | function formatDuration(ms: number): string { |
| 9 | if (ms < 60_000) return `${Math.round(ms / 1000)}s` |
| 10 | const m = Math.floor(ms / 60_000) |
| 11 | const s = Math.round((ms % 60_000) / 1000) |
| 12 | return s > 0 ? `${m}m ${s}s` : `${m}m` |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * Decode a JWT's payload segment without verifying the signature. |
no outgoing calls
no test coverage detected