-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: size unit convert functions (#2859)
Refactors binary and decimal size unit conversion functions This PR renames `iSizeToSize` to `convertBinarySizeUnit` and adds a new `convertDecimalSizeUnit` function to clearly distinguish between binary (1024-based) and decimal (1000-based) size unit conversions. The changes improve code readability and maintainability by: - Renaming `iSizeToSize` to the more descriptive `convertBinarySizeUnit` - Adding `convertDecimalSizeUnit` for 1000-based conversions - Introducing a shared internal `convertSizeUnit` function - Adding comprehensive unit tests for both conversion methods - Adding support for automatic unit selection with 'auto' parameter - Adding proper TypeScript exports for size unit types **Checklist:** - [ ] Test cases added to demonstrate binary vs decimal conversions - [ ] Unit tests verify correct handling of edge cases and automatic unit selection - [ ] All existing functionality maintained with renamed function
- Loading branch information
Showing
15 changed files
with
371 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.