@bookipi/htmlgenerator 1.1.23-alpha3 → 1.1.23-alpha4

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.
package/dist/index.js CHANGED
@@ -1603,15 +1603,23 @@ var numberFormat = {
1603
1603
  }
1604
1604
  };
1605
1605
 
1606
- Number.prototype.formatMoney = function (c, d, t) {
1607
- var n = this,
1608
- c = isNaN(c = Math.abs(c)) ? 2 : c,
1609
- d = d == undefined ? "." : d,
1610
- t = t == undefined ? "," : t,
1611
- s = n < 0 ? "-" : "",
1612
- i = String(parseInt(n = Math.abs(Number(n) || 0).toFixed(c))),
1613
- j = (j = i.length) > 3 ? j % 3 : 0;
1614
- 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) : "");
1606
+ Number.prototype.formatMoney = function (c, d, t, forcePositive) {
1607
+ var _this = this;
1608
+
1609
+ if (forcePositive === void 0) {
1610
+ forcePositive = false;
1611
+ }
1612
+
1613
+ return function (c, d, t) {
1614
+ var n = forcePositive ? Math.abs(_this) : _this,
1615
+ c = isNaN(c = Math.abs(c)) ? 2 : c,
1616
+ d = d == undefined ? "." : d,
1617
+ t = t == undefined ? "," : t,
1618
+ s = n < 0 ? "-" : "",
1619
+ i = String(parseInt(n = Math.abs(Number(n) || 0).toFixed(c))),
1620
+ j = (j = i.length) > 3 ? j % 3 : 0;
1621
+ 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) : "");
1622
+ }(c, d, t);
1615
1623
  };
1616
1624
 
1617
1625
  var currencyFormat = function currencyFormat(value, currency, lang, cFormat, rtl, removeDecimal, showLongSymbol) {
@@ -1632,7 +1640,7 @@ var currencyFormat = function currencyFormat(value, currency, lang, cFormat, rtl
1632
1640
  }
1633
1641
 
1634
1642
  var format = numberFormat[numberFormatObj];
1635
- var formattedValue = parseFloat(value).formatMoney(decimal, format.decimal, format.group);
1643
+ var formattedValue = parseFloat(value).formatMoney(decimal, format.decimal, format.group, true);
1636
1644
 
1637
1645
  if (rtl && currencies[currencyName].rtl) {
1638
1646
  formattedValue = formattedValue.split("").reverse().join("");
@@ -1640,7 +1648,7 @@ var currencyFormat = function currencyFormat(value, currency, lang, cFormat, rtl
1640
1648
 
1641
1649
  formattedValue = format.format.replace("###", formattedValue);
1642
1650
  formattedValue = formattedValue.replace("$$", symbol);
1643
- return formattedValue;
1651
+ return (value < 0 ? "-" : "") + formattedValue;
1644
1652
  };
1645
1653
 
1646
1654
  var FormatCurrency = function FormatCurrency(value, currency, language, cFormat) {
@@ -9288,14 +9296,12 @@ var defaultLang = {
9288
9296
  }
9289
9297
  };
9290
9298
 
9291
- if (!Object.fromEntries) {
9292
- Object.fromEntries = Object.fromEntries || function (arr) {
9293
- return arr.reduce(function (acc, curr) {
9294
- acc[curr[0]] = curr[1];
9295
- return acc;
9296
- }, {});
9297
- };
9298
- }
9299
+ Object.fromEntries = Object.fromEntries || function (arr) {
9300
+ return arr.reduce(function (acc, curr) {
9301
+ acc[curr[0]] = curr[1];
9302
+ return acc;
9303
+ }, {});
9304
+ };
9299
9305
 
9300
9306
  function sanitize(obj) {
9301
9307
  var object = obj;