11 lines
168 B
Go
11 lines
168 B
Go
|
package utils
|
||
|
|
||
|
func SliceFilter[T any](slice []T, filter func(T) bool) (ret []T) {
|
||
|
for _, s := range slice {
|
||
|
if filter(s) {
|
||
|
ret = append(ret, s)
|
||
|
}
|
||
|
}
|
||
|
return
|
||
|
}
|