Debian Codegraph @

kyaml/yaml/mapnode.go

raw symbols SCIP
1 // Copyright 2019 The Kubernetes Authors.
2 // SPDX-License-Identifier: Apache-2.0
3
4 package yaml
5
6 // MapNode wraps a field key and value.
7 type MapNode struct {
8 Key *RNode
9 Value *RNode
10 }
11
12 // IsNilOrEmpty returns true if the MapNode is nil,
13 // has no value, or has a value that appears empty.
14 func (mn *MapNode) IsNilOrEmpty() bool {
15 return mn == nil || mn.Value.IsNilOrEmpty()
16 }
17
18 type MapNodeSlice []*MapNode
19
20 func (m MapNodeSlice) Keys() []*RNode {
21 var keys []*RNode
22 for i := range m {
23 if m[i] != nil {
24 keys = append(keys, m[i].Key)
25 }
26 }
27 return keys
28 }
29
30 func (m MapNodeSlice) Values() []*RNode {
31 var values []*RNode
32 for i := range m {
33 if m[i] != nil {
34 values = append(values, m[i].Value)
35 } else {
36 values = append(values, nil)
37 }
38 }
39 return values
40 }