SHOW:
|
|
- or go back to the newest paste.
1 | const formatAsMoney = (amount, buyerCountry) => | |
2 | { | |
3 | let code = countries[0].code; | |
4 | let currency = countries[0].currency; | |
5 | for (let locale of countries){ | |
6 | - | if(!locale.country === buyerCountry) |
6 | + | if(locale.country === buyerCountry) |
7 | { | |
8 | code = locale.code; | |
9 | currency = locale.currency; | |
10 | break; | |
11 | } | |
12 | - | return amount.toLocaleString(`en-${code}`, |
12 | + | |
13 | ||
14 | - | style:'currency', |
14 | + | return amount.toLocaleString(`en-${code}`, |
15 | - | currency: currency, |
15 | + | |
16 | - | currencyDisplay:'symbol' |
16 | + | style:'currency', |
17 | - | }); |
17 | + | currency: currency, |
18 | currencyDisplay:'symbol' | |
19 | - | }; |
19 | + | |
20 | ); | |
21 | } |