MCPcopy Create free account
hub / github.com/github/gh-aw / Map

Function Map

pkg/sliceutil/sliceutil.go:28–34  ·  view source on GitHub ↗

Map transforms each element in a slice using the provided function. This is a pure function that does not modify the input slice.

(slice []T, transform func(T) U)

Source from the content-addressed store, hash-verified

26// Map transforms each element in a slice using the provided function.
27// This is a pure function that does not modify the input slice.
28func Map[T, U any](slice []T, transform func(T) U) []U {
29 result := make([]U, len(slice))
30 for i, item := range slice {
31 result[i] = transform(item)
32 }
33 return result
34}
35
36// MapKeys converts a map's keys to a slice.
37// The order of elements is not guaranteed as map iteration order is undefined.

Callers 15

generateFindingsFunction · 0.92
showTrialConfirmationFunction · 0.92
expandLocalWildcardFunction · 0.92
executeTrialRunFunction · 0.92
getActionDirectoriesFunction · 0.92
parseSecretNamesFunction · 0.92
selectWorkflowFunction · 0.92
ListToolsForMCPFunction · 0.92
RunWorkflowTrialsFunction · 0.92
buildAuditDataFunction · 0.92

Calls

no outgoing calls

Tested by 2

TestSpec_PublicAPI_MapFunction · 0.68
TestMapFunction · 0.68