Skip to content

Commit a249070

Browse files
authored
fix(recipe): support nil, null, undefined for condition field (#1091)
Because - we need to allow the condition field to be based on a null value. This commit - supports `nil`, `null`, and `undefined` for the condition field
1 parent 5613ee3 commit a249070

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/recipe/eval.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,15 @@ func evalExpr(expr ast.Expr, value map[string]any) (any, error) {
405405
if e.Name == "false" {
406406
return false, nil
407407
}
408+
if e.Name == "nil" {
409+
return nil, nil
410+
}
411+
if e.Name == "null" {
412+
return nil, nil
413+
}
414+
if e.Name == "undefined" {
415+
return nil, nil
416+
}
408417
val, ok := value[e.Name]
409418
if !ok {
410419
return nil, fmt.Errorf("undefined variable: %s", e.Name)

0 commit comments

Comments
 (0)