@contrail/data-grouping 1.0.14 → 1.0.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,14 +12,17 @@ class DataGroupGenerator {
12
12
  }
13
13
  let key = util_1.ObjectUtil.getByPath(obj, index);
14
14
  let value = key;
15
+ if (!value) {
16
+ return;
17
+ }
15
18
  if (key && value && typeof key === 'object') {
16
19
  key = value.id || value.name || value;
17
20
  }
18
21
  map[key] = value;
19
22
  });
20
23
  const distinctValues = [...(Object.values(map))].sort((v1, v2) => {
21
- let val1 = (typeof v1 === 'object') ? v1.name : v1;
22
- let val2 = (typeof v2 === 'object') ? v2.name : v2;
24
+ let val1 = (v1 && typeof v1 === 'object') ? v1.name : v1;
25
+ let val2 = (v2 && typeof v2 === 'object') ? v2.name : v2;
23
26
  return val1 > val2 ? 1 : -1;
24
27
  });
25
28
  return distinctValues;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/data-grouping",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "Utilities and interfaces for grouping data into hierarchial data structures based on properties.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",