MCPcopy
hub / github.com/moby/moby / Map

Function Map

internal/sliceutil/sliceutil.go:28–37  ·  view source on GitHub ↗
(s S, fn func(In) Out)

Source from the content-addressed store, hash-verified

26}
27
28func Map[S ~[]In, In, Out any](s S, fn func(In) Out) []Out {
29 if s == nil {
30 return nil
31 }
32 res := make([]Out, len(s))
33 for i, v := range s {
34 res[i] = fn(v)
35 }
36 return res
37}
38
39func Mapper[In, Out any](fn func(In) Out) func([]In) []Out {
40 return func(s []In) []Out {

Callers 15

TestIntDNSAsExtDNSFunction · 0.92
TestMapFunction · 0.92
TestMap_TypeConvertFunction · 0.92
deleteMethod · 0.92
MapPortsMethod · 0.92
parseConnectivityOptionsFunction · 0.92
MapPortsMethod · 0.92
TestGenerateIfaceNameFunction · 0.92
startMethod · 0.92
SwarmFromGRPCFunction · 0.92
containerSpecFromGRPCFunction · 0.92

Calls

no outgoing calls

Tested by 5

TestIntDNSAsExtDNSFunction · 0.74
TestMapFunction · 0.74
TestMap_TypeConvertFunction · 0.74
MapPortsMethod · 0.74
TestGenerateIfaceNameFunction · 0.74