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

feat: support setting fractionless exponent #264

Closed
wants to merge 3 commits into from

Conversation

andersem
Copy link

Support importing a number from fractionless where the accuracy is higher than the lowest exponent of the currency.

Example:

Money.fromFractionlessAmount(1000, "NOK")
// 10.00

Money.fromFractionlessAmount(1000, "NOK", { exponent: 3})
// 1.00

Money.fromFractionlessAmount(1000, "NOK", { exponent: 3, decimals: 3})
// 1.000

@andersem andersem self-assigned this Nov 20, 2024
@andersem andersem requested a review from frodeaa November 20, 2024 08:22
Copy link
Contributor

@alexpresthus alexpresthus left a comment

Choose a reason for hiding this comment

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

LGTM, maybe update usage in README.md

Support importing a number from fractionless where the accuracy is higher than the lowest exponent of the currency.

Example:

```
Money.fromFractionlessAmount(1000, "NOK")
// 10.00

Money.fromFractionlessAmount(1000, "NOK", { exponent: 3})
// 1.00

Money.fromFractionlessAmount(1000, "NOK", { exponent: 3, decimals: 3})
// 1.000
```
@andersem andersem force-pushed the feat/fromFractionLessWithExponent branch from 9a5324f to 512895e Compare November 20, 2024 09:31
@andersem
Copy link
Author

Closed, we want to handle this without updating the API

@andersem andersem closed this Nov 20, 2024
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