Skip to content

fix: handle edge cases for invalid and negative values#110

Open
jin-sir wants to merge 1 commit into
DTStack:masterfrom
jin-sir:fix_formatBytes
Open

fix: handle edge cases for invalid and negative values#110
jin-sir wants to merge 1 commit into
DTStack:masterfrom
jin-sir:fix_formatBytes

Conversation

@jin-sir

@jin-sir jin-sir commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

变更内容

  • 添加 Number(value) 转换,支持字符串数字输入(如 "1024")
  • 添加 Math.max(0, ...) 保护,防止 0 到 1 之间的小数值产生负的单位级别

变更原因

  • 处理传入数字字符串的场景
  • 修复 Math.log 对 0 到 1 之间的小数值返回负数的问题

@jin-sir jin-sir requested a review from liuxy0551 June 17, 2026 13:39
Comment thread src/formatBytes/index.ts Outdated
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.

2 participants