@rcsb/rcsb-search-tools 0.0.10 → 0.0.11

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.
@@ -19,25 +19,28 @@ function getBucketsFromFacets(searchResultFacets, labelList, recursiveOut) {
19
19
  getBucketsFromFacets(g.facets, labelList ? labelList.concat(g.label) : [g.label], out);
20
20
  });
21
21
  }
22
- const searchBucketFacet = {
23
- name: bucketFacet.name,
24
- labelPath: labelList !== null && labelList !== void 0 ? labelList : [],
25
- data: []
26
- };
27
- (_c = bucketFacet.buckets) === null || _c === void 0 ? void 0 : _c.forEach(bucket => {
28
- if (bucket.label && bucket.population)
29
- searchBucketFacet.data.push({
30
- label: bucket.label,
31
- population: bucket.population
32
- });
33
- });
34
- out.push(searchBucketFacet);
22
+ else {
23
+ const searchBucketFacet = {
24
+ name: bucketFacet.name,
25
+ labelPath: labelList !== null && labelList !== void 0 ? labelList : [],
26
+ data: []
27
+ };
28
+ (_c = bucketFacet.buckets) === null || _c === void 0 ? void 0 : _c.forEach(bucket => {
29
+ if (bucket.label && bucket.population)
30
+ searchBucketFacet.data.push({
31
+ label: bucket.label,
32
+ population: bucket.population
33
+ });
34
+ });
35
+ if (searchBucketFacet.data.length > 0)
36
+ out.push(searchBucketFacet);
37
+ }
35
38
  });
36
39
  return out;
37
40
  }
38
41
  exports.getBucketsFromFacets = getBucketsFromFacets;
39
42
  function collectFacets(facets) {
40
- return facets.map(f => ('value' in f ? {
43
+ return facets.filter(f => 'value' in f || ('buckets' in f && f.buckets.length > 0)).map(f => ('value' in f ? {
41
44
  name: f.name,
42
45
  buckets: [{
43
46
  label: f.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rcsb/rcsb-search-tools",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "RCSB PDB Search API request tools",
5
5
  "main": "build/app.js",
6
6
  "files": [