From 2b328eeb3603358f25183d9d930dbe375dc857da Mon Sep 17 00:00:00 2001 From: jregan Date: Mon, 10 Aug 2020 12:37:13 -0700 Subject: [PATCH] Remove unused IsFieldEmpty, add more godoc. --- kyaml/yaml/types.go | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/kyaml/yaml/types.go b/kyaml/yaml/types.go index 4c6e1bab7..75102cdbe 100644 --- a/kyaml/yaml/types.go +++ b/kyaml/yaml/types.go @@ -45,24 +45,18 @@ func IsEmptyMap(node *RNode) bool { return IsMissingOrNull(node) || IsYNodeEmptyMap(node.YNode()) } -func IsFieldEmpty(node *MapNode) bool { - if node == nil || node.Value == nil || node.Value.YNode() == nil || - node.Value.YNode().Tag == NodeTagNull { - return true - } - return IsYNodeEmptyMap(node.Value.YNode()) || - IsYNodeEmptySeq(node.Value.YNode()) -} - -func IsYNodeEmptyMap(n *yaml.Node) bool { - return n != nil && n.Kind == yaml.MappingNode && len(n.Content) == 0 -} - // IsYNodeTaggedNull returns true if the node is explicitly tagged Null. func IsYNodeTaggedNull(n *yaml.Node) bool { return n != nil && n.Tag == NodeTagNull } +// IsYNodeEmptyMap is true if the Node is a non-nil empty map. +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. func IsYNodeEmptySeq(n *yaml.Node) bool { return n != nil && n.Kind == yaml.SequenceNode && len(n.Content) == 0 }