functions-samples
functions-samples copied to clipboard
Stripe functions example: incorrect type handling
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.)