(items []T, getKey func(item T) string)
| 86 | } |
| 87 | |
| 88 | func MakeItemMapAndOptions[T any](items []T, getKey func(item T) string) (map[string]T, []string) { |
| 89 | optionMap := make(map[string]T, len(items)) |
| 90 | options := make([]string, 0, len(items)) |
| 91 | for _, item := range items { |
| 92 | key := getKey(item) |
| 93 | optionMap[key] = item |
| 94 | options = append(options, key) |
| 95 | } |
| 96 | return optionMap, options |
| 97 | } |
no outgoing calls
no test coverage detected