This commit is contained in:
Mike Schwörer 2023-02-14 16:25:45 +01:00
parent 9f5612248a
commit bf16a8165f
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF

View File

@ -265,6 +265,14 @@ func ArrMap[T1 any, T2 any](arr []T1, conv func(v T1) T2) []T2 {
return r
}
func ArrMapExt[T1 any, T2 any](arr []T1, conv func(idx int, v T1) T2) []T2 {
r := make([]T2, len(arr))
for i, v := range arr {
r[i] = conv(i, v)
}
return r
}
func ArrFilterMap[T1 any, T2 any](arr []T1, filter func(v T1) bool, conv func(v T1) T2) []T2 {
r := make([]T2, 0, len(arr))
for _, v := range arr {