@darkpos/utils 1.0.9 → 1.0.11

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.
@@ -172,6 +172,7 @@ const formatAmountWithCurrency = (amount, currency, locale) =>
172
172
  ? new Intl.NumberFormat(locale, {
173
173
  style: 'currency',
174
174
  currency,
175
+ signDisplay: 'negative'
175
176
  }).format(Number(amount))
176
177
  : '';
177
178
 
package/lib/math.js CHANGED
@@ -90,6 +90,9 @@ const max = (...args) => Decimal.max(...args).toNumber();
90
90
 
91
91
  const min = (...args) => Decimal.min(...args).toNumber();
92
92
 
93
+ const toNearestMultiple = (x, nearestMultiple) =>
94
+ Decimal(x).toNearest(nearestMultiple, Decimal.ROUND_UP).toNumber();
95
+
93
96
  module.exports = {
94
97
  mul,
95
98
  div,
@@ -106,4 +109,5 @@ module.exports = {
106
109
  toDecimalPlaces,
107
110
  max,
108
111
  min,
112
+ toNearestMultiple,
109
113
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darkpos/utils",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "General purpose utilities",
5
5
  "author": "Dark POS",
6
6
  "homepage": "https://gitlab.com/darkpos/packages/dark#readme",
@@ -39,5 +39,5 @@
39
39
  "eslint-plugin-prettier": "^4.0.0",
40
40
  "prettier": "^2.7.0"
41
41
  },
42
- "gitHead": "6648705882ec8351463ba823c213cf7c198129ce"
42
+ "gitHead": "fc81201b39f7ea2880fd368a8e541e4fa0750459"
43
43
  }