...
1
2
3
4 package yaml
5
6
7 type MapNode struct {
8 Key *RNode
9 Value *RNode
10 }
11
12
13
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 }
41
View as plain text