@darkpos/utils 1.0.12 → 1.0.13

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/lib/helpers.js CHANGED
@@ -84,6 +84,8 @@ const checkKey = (json, key) => {
84
84
  return true;
85
85
  };
86
86
 
87
+ const toNumberOrZero = value => (!value ? 0 : Number(value) || 0);
88
+
87
89
  //
88
90
  module.exports = {
89
91
  hasProperty,
@@ -101,4 +103,5 @@ module.exports = {
101
103
  mergeArrays,
102
104
  isArrayEqual,
103
105
  clearEmptyValues,
106
+ toNumberOrZero,
104
107
  };
package/lib/math.js CHANGED
@@ -93,6 +93,8 @@ const min = (...args) => Decimal.min(...args).toNumber();
93
93
  const toNearestMultiple = (x, nearestMultiple) =>
94
94
  Decimal(x).toNearest(nearestMultiple, Decimal.ROUND_UP).toNumber();
95
95
 
96
+ const floor = x => Decimal.floor(x);
97
+
96
98
  module.exports = {
97
99
  mul,
98
100
  div,
@@ -110,4 +112,5 @@ module.exports = {
110
112
  max,
111
113
  min,
112
114
  toNearestMultiple,
115
+ floor,
113
116
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darkpos/utils",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
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": "4e966b805abc74cc31cb0b3a0754e71f9bb913e5"
42
+ "gitHead": "94c96f8e898bff82463d49bfb39f27ef0e70909e"
43
43
  }