@thecb/components 11.5.1 → 11.5.2
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.cjs.js
CHANGED
|
@@ -1699,11 +1699,15 @@ return numeral;
|
|
|
1699
1699
|
});
|
|
1700
1700
|
|
|
1701
1701
|
var noop$1 = function noop() {};
|
|
1702
|
+
var round = function round(value) {
|
|
1703
|
+
var decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
1704
|
+
return Number(Math.round(Number("".concat(value, "e").concat(decimals))) + "e-".concat(decimals));
|
|
1705
|
+
};
|
|
1702
1706
|
var formatMoneyString = function formatMoneyString(s) {
|
|
1703
1707
|
return numeral(s).format("$0,0.00");
|
|
1704
1708
|
};
|
|
1705
1709
|
var convertCentsToMoneyDecimal = function convertCentsToMoneyDecimal(n) {
|
|
1706
|
-
return (n / 100
|
|
1710
|
+
return round(n / 100, 2);
|
|
1707
1711
|
};
|
|
1708
1712
|
var displayCurrency = function displayCurrency(cents) {
|
|
1709
1713
|
return formatMoneyString(convertCentsToMoneyDecimal(cents));
|
|
@@ -1877,6 +1881,7 @@ var adjustHexColor = function adjustHexColor(hex, percent, action) {
|
|
|
1877
1881
|
var general = /*#__PURE__*/Object.freeze({
|
|
1878
1882
|
__proto__: null,
|
|
1879
1883
|
noop: noop$1,
|
|
1884
|
+
round: round,
|
|
1880
1885
|
displayCurrency: displayCurrency,
|
|
1881
1886
|
convertCentsToMoneyInt: convertCentsToMoneyInt,
|
|
1882
1887
|
formatPercent: formatPercent,
|