-
Notifications
You must be signed in to change notification settings - Fork 77
feat(FR-918): Add BigNumber to manage bit number #3674
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
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a BigNumber helper class extending Big.js to support size unit handling and conversion, along with accompanying unit tests and dependency updates.
- Adds a BigNumber class with unit parsing, automatic unit selection, and conversion methods.
- Introduces tests verifying BigNumber behaviors.
- Updates dependencies in package.json to include Big.js and its types.
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
react/src/helper/big-number.ts | Implements BigNumber class with unit conversion and parsing logic |
react/src/helper/big-number.test.ts | Adds tests for parsing and unit conversion functionalities |
react/package.json | Updates dependency versions for Big.js and associated type definitions |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
e45e101
to
a6a4077
Compare
a6a4077
to
074b140
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a BigNumber utility class using the big.js library to provide precise arithmetic and unit conversion functionality for handling large numbers. Key changes include:
- Introducing the BigNumber utility class with functions for parsing, converting, comparing, adding, and subtracting numbers with units.
- Adding comprehensive test coverage for BigNumber operations.
- Fixing a typo in the existing helper function name.
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
react/src/helper/index.tsx | Corrected function name typo from "subNumberWihUnits" to "subNumberWithUnits". |
react/src/helper/big-number.ts | Added BigNumber utility class with unit parsing, conversion, and arithmetic functions. |
react/src/helper/big-number.test.ts | Added tests covering all BigNumber functionality. |
react/package.json | Added the big.js library and its type definitions. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
react/src/helper/index.tsx:270
- The function name has been corrected from 'subNumberWihUnits' to 'subNumberWithUnits', which improves clarity. Please ensure all internal references use the updated name.
export function subNumberWithUnits(
2c454e0
to
8d6a295
Compare
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🔴 | Statements | 4.56% | 479/10494 |
🔴 | Branches | 4.03% | 297/7361 |
🔴 | Functions | 2.72% | 90/3311 |
🔴 | Lines | 4.52% | 464/10271 |
Test suite run success
161 tests passing in 15 suites.
Report generated by 🧪jest coverage report action from eb7ab1c
8d6a295
to
0ab6e5b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to update pnpm-lock.yaml I got import error from @jest/globals
and @jest/test
I didn't touch any packages related to jest. Other tests are working well on main branch. Please let me see the error you've got @lizable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All tests have been passed. LGTM.
How to test:
- Go to
react
directory - input
pnpm test src/helper/big-number.test.ts
- See all test have been passed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Merge activity
|
# Add big.js library for precise number handling Added the big.js library and created a BigNumber utility class to handle large numbers and unit conversions with precision. This implementation provides: - Parsing of numbers with units (e.g., "123px", "45.67em") - Converting between binary size units (B, K, M, G, T, P, E) - Comparing numbers with different units - Adding and subtracting numbers with units - Range validation for numbers with units - Formatting numbers without trailing zeros The utility includes comprehensive test coverage to ensure reliability. resolves #3593 (FR-918)
0ab6e5b
to
eb7ab1c
Compare
Add big.js library for precise number handling
Added the big.js library and created a BigNumber utility class to handle large numbers and unit conversions with precision. This implementation provides:
The utility includes comprehensive test coverage to ensure reliability.
resolves #3593 (FR-918)