MCPcopy Create free account
hub / github.com/appleboy/CodeGPT / ConvertToMap

Function ConvertToMap

util/util.go:28–37  ·  view source on GitHub ↗

ConvertToMap takes a slice of strings in the format "key=value" and converts it into a Data map. Each string in the slice is split into a key and value pair using the first occurrence of the "=" character. If a string does not contain the "=" character, it is ignored. The resulting map contains the

(args []string)

Source from the content-addressed store, hash-verified

26//
27// Data: A map where the keys and values are derived from the input slice.
28func ConvertToMap(args []string) Data {
29 m := make(Data)
30 for _, arg := range args {
31 kv := strings.SplitN(arg, "=", 2)
32 if len(kv) == 2 {
33 m[kv[0]] = kv[1]
34 }
35 }
36 return m
37}

Callers 3

commit.goFile · 0.92
TestConvertToMapFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestConvertToMapFunction · 0.68