SHARE
TWEET

Untitled

a guest Aug 18th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
  7.     {
  8.         code = locale.code;
  9.         currency = locale.currency;
  10.  
  11.     }
  12.     return amount.toLocaleString(`en-${code}`,
  13.     {
  14. style:'currency',
  15. currency: currency,
  16. currencyDisplay:'symbol'
  17.     });
  18. }
  19.      };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top