(bytes: number)
| 172 | |
| 173 | /** `24.2 KB` — sizes on this screen are for scale, never for accounting. */ |
| 174 | export function formatBytes(bytes: number): string { |
| 175 | if (!Number.isFinite(bytes) || bytes < 0) return '—'; |
| 176 | if (bytes < 1024) return `${bytes} B`; |
| 177 | if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`; |
| 178 | return `${(bytes / (1024 * 1024)).toFixed(1)} MB`; |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * The line under the file name: `typescript · 24.2 KB · 23 symbols · generated`. |
no outgoing calls
no test coverage detected