v0.0.90
This commit is contained in:
parent
dba0cd229e
commit
ee325f67fd
@ -295,6 +295,16 @@ func ArrFilterMap[T1 any, T2 any](arr []T1, filter func(v T1) bool, conv func(v
|
||||
return r
|
||||
}
|
||||
|
||||
func ArrFilter[T any](arr []T, filter func(v T) bool) []T {
|
||||
r := make([]T, 0, len(arr))
|
||||
for _, v := range arr {
|
||||
if filter(v) {
|
||||
r = append(r, v)
|
||||
}
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func ArrSum[T NumberConstraint](arr []T) T {
|
||||
var r T = 0
|
||||
for _, v := range arr {
|
||||
|
Loading…
Reference in New Issue
Block a user