Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: size unit convert functions #2859

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

yomybaby
Copy link
Member

@yomybaby yomybaby commented Nov 19, 2024

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

Copy link

graphite-app bot commented Nov 19, 2024

Your org requires the Graphite merge queue for merging into main

Add the label “flow:merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “flow:hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@github-actions github-actions bot added the size:L 100~500 LoC label Nov 19, 2024
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

github-actions bot commented Nov 19, 2024

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements
5.38% (+0.12% 🔼)
395/7342
🔴 Branches
4.67% (+0.14% 🔼)
237/5077
🔴 Functions
3.22% (+0.08% 🔼)
78/2420
🔴 Lines
5.29% (+0.12% 🔼)
380/7182

Test suite run success

124 tests passing in 14 suites.

Report generated by 🧪jest coverage report action from f67ec31

@yomybaby yomybaby marked this pull request as ready for review November 19, 2024 07:53
Copy link
Contributor

@ironAiken2 ironAiken2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

graphite-app bot commented Nov 19, 2024

Merge activity

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
@yomybaby yomybaby force-pushed the feature/refactor-convert-size-unit-functions branch from 3323020 to f67ec31 Compare November 19, 2024 09:35
@graphite-app graphite-app bot merged commit f67ec31 into main Nov 19, 2024
6 checks passed
@graphite-app graphite-app bot deleted the feature/refactor-convert-size-unit-functions branch November 19, 2024 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L 100~500 LoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants