mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
16 lines
279 B
Go
16 lines
279 B
Go
package list
|
|
|
|
// Add adds a string to the list if it does not exist yet.
|
|
func Add(list []string, s string) []string {
|
|
switch {
|
|
case s == "":
|
|
return list
|
|
case len(list) == 0:
|
|
return []string{s}
|
|
case Contains(list, s):
|
|
return list
|
|
default:
|
|
return append(list, s)
|
|
}
|
|
}
|