MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / matchKey

Function matchKey

app/cli/pkg/action/policy_input_file.go:215–223  ·  view source on GitHub ↗

matchKey returns the value whose key matches column case-insensitively (trimming surrounding whitespace).

(m map[string]T, column string)

Source from the content-addressed store, hash-verified

213// matchKey returns the value whose key matches column case-insensitively
214// (trimming surrounding whitespace).
215func matchKey[T any](m map[string]T, column string) (T, bool) {
216 for k, v := range m {
217 if strings.EqualFold(strings.TrimSpace(k), strings.TrimSpace(column)) {
218 return v, true
219 }
220 }
221 var zero T
222 return zero, false
223}
224
225func filterNonEmpty(values []string) []string {
226 out := make([]string, 0, len(values))

Callers 1

extractJSONColumnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected