Is there an existing issue for this?
Current behavior
// Currencies object
"JPY": {
"code": "JPY",
"base": 10,
"exponent": 0
},
const dineroObj = {
"amount": 300,
"currency": {
"code": "JPY",
"base": 10,
"exponent": 0
},
"scale": 0
}
console.log(toDecimal(dineroObj))
// result is 300.0, expected 300
This same behavior occurs for other exponent 0 currencies.
Expected behavior
I would expect an integer value to be returned for "exponent 0" currencies, such as 300 for the above example.
Steps to reproduce
- Create a dinero object for a base 10, exponent 0 currency (e.g. JPY or VND)
- Pass it to
toDecimal(dineroObj)) and view the result.
Version
2.0.0-alpha
Note: I'm using Dinero's default JS numbers, not BigInt or other.
Environment
Node v20
Code of Conduct