diginext-utils 1.2.1 → 1.2.3

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/dist/object.js +5 -0
  2. package/package.json +2 -2
package/dist/object.js CHANGED
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.toInt = exports.toFloat = exports.toBool = exports.toArray = exports.objectToArray = exports.isNull = void 0;
9
9
 
10
+ require("core-js/modules/es.json.stringify.js");
11
+
10
12
  require("core-js/modules/es.regexp.to-string.js");
11
13
 
12
14
  require("core-js/modules/es.parse-int.js");
@@ -17,6 +19,7 @@ const isNull = object => {
17
19
  if (typeof object == "undefined") return true;
18
20
  if (object == "") return true;
19
21
  if (Array.isArray(object)) return object.length == 0;
22
+ if (JSON.stringify(object) == "{}") return true;
20
23
  return object == null;
21
24
  };
22
25
 
@@ -47,6 +50,8 @@ const toFloat = object => {
47
50
  exports.toFloat = toFloat;
48
51
 
49
52
  const toArray = obj => {
53
+ if (isNull(obj)) return [];
54
+
50
55
  if (!Array.isArray(obj)) {
51
56
  obj = [obj];
52
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginext-utils",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "author": {
5
5
  "name": "TOP GROUP (a.k.a Digitop)",
6
6
  "email": "dev@wearetopgroup.com"
@@ -52,4 +52,4 @@
52
52
  "esm": "^3.2.25",
53
53
  "mocha": "^10.0.0"
54
54
  }
55
- }
55
+ }