MCPcopy Create free account
hub / github.com/OverloadBlitz/cloudcent-cli / lookupAttrCaseInsensitive

Function lookupAttrCaseInsensitive

internal/estimate/estimator.go:573–585  ·  view source on GitHub ↗
(attrs map[string]*api.AttrValue, key string)

Source from the content-addressed store, hash-verified

571}
572
573func lookupAttrCaseInsensitive(attrs map[string]*api.AttrValue, key string) (*api.AttrValue, bool) {
574 if value, ok := attrs[key]; ok {
575 return value, true
576 }
577
578 for actualKey, value := range attrs {
579 if equalFoldTrim(actualKey, key) {
580 return value, true
581 }
582 }
583
584 return nil, false
585}
586
587func equalFoldTrim(a, b string) bool {
588 return strings.EqualFold(strings.TrimSpace(a), strings.TrimSpace(b))

Callers 1

pricingItemMatchesRecordFunction · 0.85

Calls 1

equalFoldTrimFunction · 0.85

Tested by

no test coverage detected