v0.0.85
This commit is contained in:
parent
9f5612248a
commit
bf16a8165f
@ -265,6 +265,14 @@ func ArrMap[T1 any, T2 any](arr []T1, conv func(v T1) T2) []T2 {
|
|||||||
return r
|
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 {
|
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))
|
r := make([]T2, 0, len(arr))
|
||||||
for _, v := range arr {
|
for _, v := range arr {
|
||||||
|
Loading…
Reference in New Issue
Block a user