mirror of
https://github.com/bestnite/bilinovel-downloader.git
synced 2025-06-17 06:43:18 +08:00
start
This commit is contained in:
15
utils/unique.go
Normal file
15
utils/unique.go
Normal file
@ -0,0 +1,15 @@
|
||||
package utils
|
||||
|
||||
func Unique[T comparable](slice []T) []T {
|
||||
seen := make(map[T]struct{})
|
||||
var result []T
|
||||
|
||||
for _, v := range slice {
|
||||
if _, ok := seen[v]; !ok {
|
||||
seen[v] = struct{}{}
|
||||
result = append(result, v)
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
Reference in New Issue
Block a user