MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / Map

Function Map

pkg/slicetools/slice_tools.go:3–9  ·  view source on GitHub ↗
(slice []T, mapper func(int, T) U)

Source from the content-addressed store, hash-verified

1package slicetools
2
3func Map[T any, U any](slice []T, mapper func(int, T) U) []U {
4 result := make([]U, len(slice))
5 for i, v := range slice {
6 result[i] = mapper(i, v)
7 }
8 return result
9}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected