884dea17de
Signed-off-by: Michael Mayer <michael@photoprism.app>
14 lines
270 B
Go
14 lines
270 B
Go
package list
|
|
|
|
// Add adds a string to the list if it does not exist yet.
|
|
func Add(list []string, s string) []string {
|
|
if s == "" {
|
|
return list
|
|
} else if len(list) == 0 {
|
|
return []string{s}
|
|
} else if Contains(list, s) {
|
|
return list
|
|
}
|
|
|
|
return append(list, s)
|
|
}
|