mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-12-19 16:30:07 +08:00
12 lines
205 B
Go
12 lines
205 B
Go
package utils
|
|
|
|
func Filter[T comparable](tSlice []T, filter func(t T) bool) []T {
|
|
result := make([]T, 0)
|
|
for _, t := range tSlice {
|
|
if filter(t) {
|
|
result = append(result, t)
|
|
}
|
|
}
|
|
return result
|
|
}
|