Skip to content

Commit e95de1a

Browse files
committed
Merge branch 'fix/undefined-array-operators' into 'master'
fix: Fixed exception to execute undefined arrays See merge request auto-cloud/cloudgraph/sdk!53
2 parents 1da9947 + 02183cc commit e95de1a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/rules-engine/evaluators/json-evaluator.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,9 @@ export default class JsonEvaluator implements RuleEvaluator<JsonRule> {
8484
}
8585
return true
8686
},
87-
array_all: async (array, conditions: Condition, data) => {
87+
array_all: async (array = [], conditions: Condition, data) => {
8888
// an AND, but with every resource item
8989
const baseElementPath = data.elementPath
90-
9190
for (let i = 0; i < array.length; i++) {
9291
if (
9392
!(await this.evaluateCondition(conditions, {
@@ -99,9 +98,8 @@ export default class JsonEvaluator implements RuleEvaluator<JsonRule> {
9998
}
10099
return true
101100
},
102-
array_any: async (array, conditions, data) => {
101+
array_any: async (array = [], conditions, data) => {
103102
// an OR, but with every resource item
104-
105103
const baseElementPath = data.elementPath
106104
for (let i = 0; i < array.length; i++) {
107105
if (

0 commit comments

Comments
 (0)