MCPcopy
hub / github.com/rclone/rclone / get

Function get

backend/cache/plex.go:276–298  ·  view source on GitHub ↗

adapted from: https://stackoverflow.com/a/28878037 (credit)

(m any, path ...any)

Source from the content-addressed store, hash-verified

274
275// adapted from: https://stackoverflow.com/a/28878037 (credit)
276func get(m any, path ...any) (any, bool) {
277 for _, p := range path {
278 switch idx := p.(type) {
279 case string:
280 if mm, ok := m.(map[string]any); ok {
281 if val, found := mm[idx]; found {
282 m = val
283 continue
284 }
285 }
286 return nil, false
287 case int:
288 if mm, ok := m.([]any); ok {
289 if len(mm) > idx {
290 m = mm[idx]
291 continue
292 }
293 }
294 return nil, false
295 }
296 }
297 return m, true
298}

Callers 2

authenticateMethod · 0.85
assertHeadersAndMetadataFunction · 0.85

Calls

no outgoing calls

Tested by 1

assertHeadersAndMetadataFunction · 0.68