@contrail/data-grouping 1.0.42 → 1.0.43

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.
@@ -23,13 +23,22 @@ class DataGroupGenerator {
23
23
  }
24
24
  }
25
25
  let value = key;
26
- if ((!value || (typeof value === 'number' && isNaN(value))) && displayItemsWithEmptyGroupingValues) {
27
- hasEmptyValues = true;
28
- value = '(empty)';
29
- key = '(empty)';
30
- }
31
- else if (!value || (typeof value === 'number' && isNaN(value))) {
32
- return;
26
+ const isEmptyValue = (value === undefined ||
27
+ value === null ||
28
+ value === '' ||
29
+ (Array.isArray(value) && value.length === 0) ||
30
+ (typeof value === 'string' && value.trim() === '') ||
31
+ (typeof value === 'number' && isNaN(value))) &&
32
+ value !== false;
33
+ if (isEmptyValue) {
34
+ if (displayItemsWithEmptyGroupingValues) {
35
+ hasEmptyValues = true;
36
+ value = '(empty)';
37
+ key = '(empty)';
38
+ }
39
+ else {
40
+ return;
41
+ }
33
42
  }
34
43
  if (propertyTypeOptions.isDate && value) {
35
44
  const date = new Date(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/data-grouping",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
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",