MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / ensureMappingScalar

Function ensureMappingScalar

internal/pluginhost/config.go:179–192  ·  view source on GitHub ↗
(node *yaml.Node, key, value, tag string)

Source from the content-addressed store, hash-verified

177}
178
179func ensureMappingScalar(node *yaml.Node, key, value, tag string) {
180 if node == nil || node.Kind != yaml.MappingNode {
181 return
182 }
183 for i := 0; i+1 < len(node.Content); i += 2 {
184 if node.Content[i] != nil && node.Content[i].Value == key {
185 return
186 }
187 }
188 node.Content = append(node.Content,
189 &yaml.Node{Kind: yaml.ScalarNode, Tag: "!!str", Value: key},
190 &yaml.Node{Kind: yaml.ScalarNode, Tag: tag, Value: value},
191 )
192}
193
194func boolYAMLValue(v bool) string {
195 if v {

Callers 1

normalizedConfigNodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected