Skip to content

[codex] Fix formatBytes edge cases#17

Draft
Jaco-Ren wants to merge 1 commit into
OpenNSWM-Lab:mainfrom
Jaco-Ren:codex/fix-formatbytes-edge-cases-clean
Draft

[codex] Fix formatBytes edge cases#17
Jaco-Ren wants to merge 1 commit into
OpenNSWM-Lab:mainfrom
Jaco-Ren:codex/fix-formatbytes-edge-cases-clean

Conversation

@Jaco-Ren

Copy link
Copy Markdown

Summary

  • Clamp formatBytes to supported units through EB so very large values do not render with an undefined unit.
  • Return a stable placeholder for negative, NaN, and infinite values instead of producing invalid output.
  • Add focused Vitest coverage for byte formatting across normal, invalid, and out-of-range inputs.

Fixes #15.

Validation

  • npm.cmd test -- --run src/lib/utils.test.ts
  • npm.cmd run typecheck
  • npm.cmd run build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

formatBytes returns wrong unit for >= 1 PiB and crashes on negative/NaN

1 participant