Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const formatAsMoney = (amount, buyerCountry) =>
- {
- let code = countries[0].code;
- let currency = countries[0].currency;
- for (let locale of countries){
- if(locale.country === buyerCountry)
- {
- code = locale.code;
- currency = locale.currency;
- break;
- }
- }
- return amount.toLocaleString(`en-${code}`,
- {
- style:'currency',
- currency: currency,
- currencyDisplay:'symbol'
- }
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement