mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
refactor: single function to visit mapping node content
Refactor mapping node content traversal so that all code paths execute through the same root function.
This commit is contained in:
@@ -39,11 +39,20 @@ func IsYNodeEmptyMap(n *yaml.Node) bool {
|
||||
return n != nil && n.Kind == yaml.MappingNode && len(n.Content) == 0
|
||||
}
|
||||
|
||||
// IsYNodeEmptyMap is true if the Node is a non-nil empty sequence.
|
||||
// IsYNodeEmptySeq is true if the Node is a non-nil empty sequence.
|
||||
func IsYNodeEmptySeq(n *yaml.Node) bool {
|
||||
return n != nil && n.Kind == yaml.SequenceNode && len(n.Content) == 0
|
||||
}
|
||||
|
||||
// IsYNodeNilOrEmpty is true if the Node is nil or appears empty.
|
||||
func IsYNodeNilOrEmpty(n *yaml.Node) bool {
|
||||
return n == nil ||
|
||||
IsYNodeTaggedNull(n) ||
|
||||
IsYNodeEmptyMap(n) ||
|
||||
IsYNodeEmptySeq(n) ||
|
||||
IsYNodeZero(n)
|
||||
}
|
||||
|
||||
// IsYNodeEmptyDoc is true if the node is a Document with no content.
|
||||
// E.g.: "---\n---"
|
||||
func IsYNodeEmptyDoc(n *yaml.Node) bool {
|
||||
|
||||
Reference in New Issue
Block a user