mirror of
https://github.com/monero-project/monero-gui.git
synced 2026-04-01 22:47:26 -04:00
Fiat API
Co-Authored-By: selsta <selsta@sent.at> Co-Authored-By: Gene Peters <gene@telligent-data.com>
This commit is contained in:
17
js/Utils.js
17
js/Utils.js
@@ -154,3 +154,20 @@ function qmlEach(item, properties, ignoredObjectNames, arr){
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
function capitalize(s){
|
||||
if (typeof s !== 'string') return ''
|
||||
return s.charAt(0).toUpperCase() + s.slice(1)
|
||||
}
|
||||
|
||||
function formatMoney(n, c, d, t) {
|
||||
// https://stackoverflow.com/a/149099
|
||||
var c = isNaN(c = Math.abs(c)) ? 2 : c,
|
||||
d = d == undefined ? "." : d,
|
||||
t = t == undefined ? "," : t,
|
||||
s = n < 0 ? "-" : "",
|
||||
i = String(parseInt(n = Math.abs(Number(n) || 0).toFixed(c))),
|
||||
j = (j = i.length) > 3 ? j % 3 : 0;
|
||||
|
||||
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user