MCPcopy Create free account
hub / github.com/TryHarder-L/NiniMenu / appendMissingStringValues

Function appendMissingStringValues

backend/internal/database/database.go:196–214  ·  view source on GitHub ↗
(existing []string, defaults []string)

Source from the content-addressed store, hash-verified

194}
195
196func appendMissingStringValues(existing []string, defaults []string) []string {
197 seen := make(map[string]bool, len(existing)+len(defaults))
198 result := make([]string, 0, len(existing)+len(defaults))
199 for _, value := range existing {
200 if value == "" || seen[value] {
201 continue
202 }
203 seen[value] = true
204 result = append(result, value)
205 }
206 for _, value := range defaults {
207 if value == "" || seen[value] {
208 continue
209 }
210 seen[value] = true
211 result = append(result, value)
212 }
213 return result
214}
215
216func stringSet(values []string) map[string]bool {
217 result := make(map[string]bool, len(values))

Callers 2

upsertStringArraySettingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected