isite 2022.1.15 → 2022.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -406,15 +406,15 @@
|
|
|
406
406
|
return parseFloat(n);
|
|
407
407
|
};
|
|
408
408
|
|
|
409
|
-
site.to_money = site.toMoney = function (_num,
|
|
409
|
+
site.to_money = site.toMoney = function (_num, float = true) {
|
|
410
410
|
let n = 0;
|
|
411
411
|
if (_num) {
|
|
412
412
|
_num = _num.toFixed(2).split('.');
|
|
413
413
|
let n1 = _num[0];
|
|
414
|
-
let n2 = _num[1];
|
|
414
|
+
let n2 = _num[1] || '00';
|
|
415
415
|
if (n2) {
|
|
416
|
-
let n3 = n2[0];
|
|
417
|
-
let n4 = n2[1];
|
|
416
|
+
let n3 = n2[0] || '0';
|
|
417
|
+
let n4 = n2[1] || '0';
|
|
418
418
|
if (n4 && parseInt(n4) > 5) {
|
|
419
419
|
n3 = parseInt(n3) + 1;
|
|
420
420
|
n3 = n3 * 10;
|
|
@@ -431,12 +431,16 @@
|
|
|
431
431
|
n4 = 5;
|
|
432
432
|
_num[1] = n3 + n4;
|
|
433
433
|
} else {
|
|
434
|
-
_num[1] = n3;
|
|
434
|
+
_num[1] = n3 + '0';
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
437
|
n = _num.join('.');
|
|
438
438
|
}
|
|
439
|
-
|
|
439
|
+
if (!float) {
|
|
440
|
+
return n;
|
|
441
|
+
} else {
|
|
442
|
+
return site.to_float(n);
|
|
443
|
+
}
|
|
440
444
|
};
|
|
441
445
|
|
|
442
446
|
site.to_float = site.toFloat = function (_num) {
|