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

Function Get

internal/editorconfig/keypath.go:62–76  ·  view source on GitHub ↗

Get walks data using parts and returns the leaf value plus whether it was found. Intermediate non-map values cause a not-found result.

(data map[string]any, parts []string)

Source from the content-addressed store, hash-verified

60// Get walks data using parts and returns the leaf value plus whether it was
61// found. Intermediate non-map values cause a not-found result.
62func Get(data map[string]any, parts []string) (any, bool) {
63 cursor := any(data)
64 for _, part := range parts {
65 m, ok := cursor.(map[string]any)
66 if !ok {
67 return nil, false
68 }
69 val, ok := m[part]
70 if !ok {
71 return nil, false
72 }
73 cursor = val
74 }
75 return cursor, true
76}
77
78// Set assigns value at parts inside data, creating intermediate maps as
79// needed. Existing non-map intermediates are overwritten with a fresh map.

Calls

no outgoing calls