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

Function excludeMapKeys

pkg/workflow/map_helpers.go:43–64  ·  view source on GitHub ↗

excludeMapKeys creates a new map excluding the specified keys

(original map[string]any, excludeKeys ...string)

Source from the content-addressed store, hash-verified

41
42// excludeMapKeys creates a new map excluding the specified keys
43func excludeMapKeys(original map[string]any, excludeKeys ...string) map[string]any {
44 if mapHelpersLog.Enabled() {
45 mapHelpersLog.Printf("excludeMapKeys: input=%d keys, excluding=%v", len(original), excludeKeys)
46 }
47 excludeSet := make(map[string]struct {
48 })
49 for _, key := range excludeKeys {
50 excludeSet[key] = struct {
51 }{}
52 }
53
54 result := make(map[string]any)
55 for key, value := range original {
56 if !setutil.Contains(excludeSet, key) {
57 result[key] = value
58 }
59 }
60 if mapHelpersLog.Enabled() {
61 mapHelpersLog.Printf("excludeMapKeys: output=%d keys", len(result))
62 }
63 return result
64}

Callers 2

parseOnSectionMethod · 0.85
TestExcludeMapKeysFunction · 0.85

Calls 3

ContainsFunction · 0.92
EnabledMethod · 0.45
PrintfMethod · 0.45

Tested by 1

TestExcludeMapKeysFunction · 0.68