aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authordsc <xmrdsc@protonmail.com>2019-05-01 04:05:16 +0200
committerxmrdsc <xmrdsc@protonmail.com>2019-05-06 04:36:23 +0200
commitd4be7634cbc80cd40c2ff8456bcd962b21b2dcb6 (patch)
tree7fe6aa54f2935adc94d829c875b2300db272810c /js
parent3c1fe1da8b83738cb76a1a1242514bbe4ba515e6 (diff)
downloadmonzero-gui-d4be7634cbc80cd40c2ff8456bcd962b21b2dcb6.tar.gz
monzero-gui-d4be7634cbc80cd40c2ff8456bcd962b21b2dcb6.tar.xz
monzero-gui-d4be7634cbc80cd40c2ff8456bcd962b21b2dcb6.zip
Fiat API
Co-Authored-By: selsta <selsta@sent.at> Co-Authored-By: Gene Peters <gene@telligent-data.com>
Diffstat (limited to 'js')
-rw-r--r--js/Utils.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/js/Utils.js b/js/Utils.js
index f5a7d828..1dc359d9 100644
--- a/js/Utils.js
+++ b/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) : "");
+};