NormalizedEnumValue returns the canonical allowed value matching value after case normalization, or nil when no value matches.
(value string, allowed ...string)
| 18 | // NormalizedEnumValue returns the canonical allowed value matching value after |
| 19 | // case normalization, or nil when no value matches. |
| 20 | func NormalizedEnumValue(value string, allowed ...string) *string { |
| 21 | for _, candidate := range allowed { |
| 22 | if value == strings.ToLower(candidate) { |
| 23 | match := candidate |
| 24 | return &match |
| 25 | } |
| 26 | } |
| 27 | return nil |
| 28 | } |
no outgoing calls