firebase / firebase/functions-samples
Stripe functions example: incorrect type handling
Open
- Dominant language
- JavaScript
- Stars
- 12.2k
- Forks
- 3.8k
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 1
Description
https://github.com/firebase/functions-samples/blob/5614dd71cddbe27512b41d662cc51d8d25f2a562/stripe/public/javascript/app.js#L275
In `formatAmount` it converts `amount` to a string using `.toFixed(2)`, and then tries to pass that string to `Intl.NumberFormat().format()`, but that function only accepts numbers. I just convert it back to a number, assuming the intent is just to round to two decimal places. (Although if that's the case, you'd expect a similar rounding in the `zeroDecimalCurrency` case so I'm not sure what's really intended there.)
Contributor guide
Assessment
This issue has not been assessed yet.