MCPcopy Create free account
hub / github.com/cel-expr/cel-go / RangeMap

Method RangeMap

policy/yaml.go:49–59  ·  view source on GitHub ↗

RangeMap iterates over the map and calls the provided function for each key-value pair. If the function returns false, the iteration will stop.

(node *yaml.Node, fn func(key, val *yaml.Node) bool)

Source from the content-addressed store, hash-verified

47// RangeMap iterates over the map and calls the provided function for each key-value pair. If the
48// function returns false, the iteration will stop.
49func (yc YAMLHelper) RangeMap(node *yaml.Node, fn func(key, val *yaml.Node) bool) {
50 if !yc.IsMap(node) {
51 return
52 }
53 for i := 0; i < len(node.Content); i += 2 {
54 key, val := normalizeEntry(node.Content, i)
55 if !fn(key, val) {
56 break
57 }
58 }
59}
60
61// IsString returns true if the YAML node is a string.
62func (YAMLHelper) IsString(node *yaml.Node) bool {

Callers 7

TestYAMLHelperFunction · 0.95
ParsePolicyMethod · 0.80
parseImportMethod · 0.80
ParseRuleMethod · 0.80
parseVariableInlineMethod · 0.80
parseVariableObjectMethod · 0.80
ParseMatchMethod · 0.80

Calls 2

IsMapMethod · 0.95
normalizeEntryFunction · 0.85

Tested by 1

TestYAMLHelperFunction · 0.76