discourse-subscriptions/assets/javascripts/discourse/helpers/format-currency.js.es6

29 lines
548 B
Plaintext
Raw Normal View History

import Helper from "@ember/component/helper";
2020-09-16 10:53:50 -04:00
export default Helper.helper(function (params) {
let currencySign;
2019-10-30 23:35:19 -04:00
2019-11-30 00:39:28 -05:00
switch (params[0]) {
case "EUR":
case "eur":
currencySign = "€";
break;
case "GBP":
case "gbp":
currencySign = "£";
break;
case "INR":
case "inr":
currencySign = "₹";
break;
2020-06-30 11:13:05 -04:00
case "BRL":
case "brl":
currencySign = "R$";
break;
2019-10-30 23:35:19 -04:00
default:
currencySign = "$";
2019-10-30 23:35:19 -04:00
}
2020-09-16 10:53:50 -04:00
return currencySign + params.map((p) => p.toUpperCase()).join(" ");
});