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

Function MapKeys

pkg/sliceutil/sliceutil.go:39–45  ·  view source on GitHub ↗

MapKeys converts a map's keys to a slice. The order of elements is not guaranteed as map iteration order is undefined. This is a pure function that does not modify the input map.

(m map[K]V)

Source from the content-addressed store, hash-verified

37// The order of elements is not guaranteed as map iteration order is undefined.
38// This is a pure function that does not modify the input map.
39func MapKeys[K comparable, V any](m map[K]V) []K {
40 result := make([]K, 0, len(m))
41 for key := range m {
42 result = append(result, key)
43 }
44 return result
45}
46
47// FilterMapKeys returns map keys that match the given predicate.
48// The order of elements is not guaranteed as map iteration order is undefined.

Callers 11

parseFirewallLogFunction · 0.92
collectWorkflowFilesFunction · 0.92
getSortedServerNamesFunction · 0.92
generateMCPScriptsSetupFunction · 0.92
writeMCPGatewayStepEnvFunction · 0.92
writeMCPGatewayExportsFunction · 0.92
TestMapKeysFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestMapKeysFunction · 0.68