It is hard to count how many times we have seen this bug in our actors.
const price = parseFloat('10,000.00'); console.log(price) // 10
And as usual, this bug may happen only in 1% of items but will corrupt the resulting dataset completely.
The developer can then say that he or she did not see prices going over one thousand so he or she did not expect this format. But this format is used almost everywhere! Instead of guessing we should use a simple utility that will work in 99.9% of cases. Where you deal with a very specific non-USD pricing, you can maybe reach to some specialized price parsing library (and there are plenty on NPM).
What about this?
const parsePrice = (priceString) => Number(priceString.replace(/[^0-9.]/g, '')); console.log(parsePrice('10,000.00')) // 10000 console.log(parsePrice('$10,000.00')) // 10000 console.log(parsePrice('10,000.00USD')) // 10000
If you have a better idea, let me know.