-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Align amount conversion utilities between api and loot-core #5747
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
base: master
Are you sure you want to change the base?
Align amount conversion utilities between api and loot-core #5747
Conversation
Updates api amount conversion utilities to align with loot-core, improving consistency and maintainability across the project. Uses decimal places as parameters in conversion functions.
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Bundle Stats — desktop-clientHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset No files were changed View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
Bundle Stats — loot-coreHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset
View detailed bundle breakdownAdded
Removed
Bigger No assets were bigger Smaller No assets were smaller Unchanged No assets were unchanged |
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.
It would be nice to have these typed
@@ -1,7 +1,9 @@ | |||
export function amountToInteger(n) { | |||
return Math.round(n * 100); | |||
export function amountToInteger(amount, decimalPlaces = 2) { |
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.
export function amountToInteger(amount, decimalPlaces = 2) { | |
export function amountToInteger(amount: Amount, decimalPlaces = 2) { |
|
||
export function integerToAmount(n) { | ||
return parseFloat((n / 100).toFixed(2)); | ||
export function integerToAmount(integerAmount, decimalPlaces = 2) { |
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.
export function integerToAmount(integerAmount, decimalPlaces = 2) { | |
export function integerToAmount(integerAmount: IntegerAmount, decimalPlaces = 2) { |
Updates api amount conversion utilities to align with loot-core, improving consistency and maintainability across the project.
Uses decimal places as parameters in conversion functions, just like the typescript equivalents.