MCPcopy
hub / github.com/BishopFox/jsluice / GetKeys

Method GetKeys

objects.go:85–104  ·  view source on GitHub ↗

GetKeys returns a slice of all keys in an object

()

Source from the content-addressed store, hash-verified

83
84// GetKeys returns a slice of all keys in an object
85func (o Object) GetKeys() []string {
86 out := make([]string, 0)
87 if !o.HasValidNode() {
88 return out
89 }
90
91 count := int(o.node.NamedChildCount())
92
93 for i := 0; i < count; i++ {
94 pair := o.node.NamedChild(i)
95
96 if pair.Type() != "pair" {
97 continue
98 }
99
100 key := pair.ChildByFieldName("key").RawString()
101 out = append(out, key)
102 }
103 return out
104}
105
106// GetObject returns the property corresponding to the
107// provided key as an Object

Callers 5

AsMapMethod · 0.95
awsMatcherFunction · 0.80
matchJQueryFunction · 0.80
AllSecretMatchersFunction · 0.80
firebaseMatcherFunction · 0.80

Calls 6

HasValidNodeMethod · 0.95
NamedChildCountMethod · 0.80
NamedChildMethod · 0.80
RawStringMethod · 0.80
ChildByFieldNameMethod · 0.80
TypeMethod · 0.45

Tested by

no test coverage detected