@darkpos/utils 1.0.10 → 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.
Files changed (2) hide show
  1. package/lib/math.js +4 -0
  2. package/package.json +2 -2
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.10",
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": "e34041588c206612b5c2dff2e27aa34ac838137e"
42
+ "gitHead": "fc81201b39f7ea2880fd368a8e541e4fa0750459"
43
43
  }