File: dedupe.go

package info (click to toggle)
golang-github-nicholas-fedor-shoutrrr 0.8.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,332 kB
  • sloc: sh: 61; makefile: 5
file content (16 lines) | stat: -rw-r--r-- 296 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package dedupe

import "slices"

// RemoveDuplicates from a slice of strings.
func RemoveDuplicates(src []string) []string {
	unique := make([]string, 0, len(src))
	for _, s := range src {
		found := slices.Contains(unique, s)
		if !found {
			unique = append(unique, s)
		}
	}

	return unique
}