Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyas-goenka committed Jun 18, 2024
1 parent 13c2f36 commit 9b26f70
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libs/dyn/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ var NilValue = Value{
k: KindNil,
}

// Whether a value is nil or empty. A value with a non empty metadata (like location)
// is considered non-nil. Values with KindNil but non-empty metadata could for example
// denote a YAML field that explictly set to null / no value.
// TODO: Add tests for this method.
func (v Value) IsNil() bool {
return v.k == KindNil && v.v == nil
return v.k == KindNil && v.v == nil && v.l == (Location{}) && len(v.yamlLocations) == 0 && !v.anchor
}

// V constructs a new Value with the given value.
Expand Down

0 comments on commit 9b26f70

Please sign in to comment.