MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / flattenInto

Function flattenInto

internal/editorconfig/keypath.go:126–147  ·  view source on GitHub ↗
(value any, prefix string, out map[string]string)

Source from the content-addressed store, hash-verified

124}
125
126func flattenInto(value any, prefix string, out map[string]string) {
127 switch typed := value.(type) {
128 case map[string]any:
129 for k, v := range typed {
130 next := k
131 if prefix != "" {
132 next = prefix + "." + k
133 }
134 flattenInto(v, next, out)
135 }
136 case []any:
137 for i, v := range typed {
138 next := strconv.Itoa(i)
139 if prefix != "" {
140 next = prefix + "." + strconv.Itoa(i)
141 }
142 flattenInto(v, next, out)
143 }
144 default:
145 out[prefix] = fmt.Sprintf("%v", typed)
146 }
147}
148
149var intRE = regexp.MustCompile(`^-?\d+$`)
150var floatRE = regexp.MustCompile(`^-?\d+\.\d+$`)

Callers 1

FlattenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected