theprogrammablemind_4wp 7.5.8-beta.72 → 7.5.8-beta.73

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/project.js +10 -4
package/package.json CHANGED
@@ -64,6 +64,6 @@
64
64
  "json-stable-stringify": "^1.0.1",
65
65
  "node-fetch": "^2.6.1"
66
66
  },
67
- "version": "7.5.8-beta.72",
67
+ "version": "7.5.8-beta.73",
68
68
  "license": "ISC"
69
69
  }
package/src/project.js CHANGED
@@ -13,15 +13,21 @@ const project = (object, filter) => {
13
13
  if (typeof properties == 'object') {
14
14
  if (properties.propertyLists) {
15
15
  for (const propertyList in properties.propertyLists) {
16
- for (const property of object[propertyList]) {
17
- projection[property] = project(object[property], properties.propertyLists[propertyList])
16
+ if (object[propertyList]) {
17
+ for (const property of object[propertyList]) {
18
+ projection[property] = project(object[property], properties.propertyLists[propertyList])
19
+ }
18
20
  }
19
21
  }
20
22
  }
21
23
  if (properties.valueLists) {
22
24
  for (const listProperty in properties.valueLists) {
23
- const oldList = object[listProperty]
24
- projection[listProperty] = oldList.map((element) => project(element, properties.valueLists[listProperty]))
25
+ const old = object[listProperty]
26
+ if (Array.isArray(old)) {
27
+ projection[listProperty] = old.map((element) => project(element, properties.valueLists[listProperty]))
28
+ } else {
29
+ projection[listProperty] = project(old, properties.valueLists[listProperty])
30
+ }
25
31
  }
26
32
  }
27
33
  if (properties.properties) {