@contrail/util 1.0.45 → 1.0.47

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.
@@ -37,13 +37,16 @@ function getObjectDiffs(before, after, prefix) {
37
37
  diffs.push(getObjectDiff(beforeVal, afterVal, prefix + commonProperty));
38
38
  }
39
39
  }
40
- else if (Array.isArray(beforeVal)) {
40
+ else if (Array.isArray(beforeVal) && Array.isArray(afterVal)) {
41
41
  const beforeArray = [...beforeVal].sort(sortFunc);
42
42
  const afterArray = [...afterVal].sort(sortFunc);
43
43
  if (JSON.stringify(beforeArray) !== JSON.stringify(afterArray)) {
44
44
  diffs.push(getObjectDiff(beforeVal, afterVal, prefix + commonProperty));
45
45
  }
46
46
  }
47
+ else if (Array.isArray(beforeVal) && !Array.isArray(afterVal)) {
48
+ diffs.push(getObjectDiff(beforeVal, afterVal, prefix + commonProperty));
49
+ }
47
50
  else {
48
51
  const nestedObjectDiffs = getObjectDiffs(beforeVal, afterVal, prefix + commonProperty + '.');
49
52
  diffs.push(...nestedObjectDiffs);
@@ -46,6 +46,9 @@ class StringUtil {
46
46
  return replacedString;
47
47
  }
48
48
  static convertToCamelCase(str) {
49
+ if (!str) {
50
+ return str;
51
+ }
49
52
  str = str.replace(/-/g, ' ');
50
53
  return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
51
54
  return index === 0 ? word.toLowerCase() : word.toUpperCase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/util",
3
- "version": "1.0.45",
3
+ "version": "1.0.47",
4
4
  "description": "General javascript utilities",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -37,6 +37,6 @@
37
37
  "testEnvironment": "node"
38
38
  },
39
39
  "dependencies": {
40
- "@contrail/types": "^3.0.45"
40
+ "@contrail/types": "^3.0.51"
41
41
  }
42
42
  }