bumped up golang version to 1.23

This commit is contained in:
2025-06-22 19:35:57 +02:00
parent efc99a9658
commit cc2ead6c4e
11 changed files with 68 additions and 30 deletions

4
map.go
View File

@ -1,6 +1,6 @@
package slices
func Map[I, O any](slice []I, mapper func(I) O) []O {
func Map[I, O any](slice []I, mapper Mapper[I, O]) []O {
ret := make([]O, 0, len(slice))
for _, v := range slice {
ret = append(ret, mapper(v))
@ -8,7 +8,7 @@ func Map[I, O any](slice []I, mapper func(I) O) []O {
return ret
}
func MapError[I, O any](slice []I, mapper func(I) (O, error)) ([]O, error) {
func MapError[I, O any](slice []I, mapper ErrorMapper[I, O]) ([]O, error) {
ret := make([]O, 0, len(slice))
for _, old := range slice {
new, err := mapper(old)