MCPcopy Create free account
hub / github.com/anus-dev/ANUS / getNestedValue

Function getNestedValue

packages/cli/src/utils/settingsUtils.ts:95–108  ·  view source on GitHub ↗

* Recursively gets a value from a nested object using a key path array.

(obj: Record<string, unknown>, path: string[])

Source from the content-addressed store, hash-verified

93 * Recursively gets a value from a nested object using a key path array.
94 */
95function getNestedValue(obj: Record<string, unknown>, path: string[]): unknown {
96 const [first, ...rest] = path;
97 if (!first || !(first in obj)) {
98 return undefined;
99 }
100 const value = obj[first];
101 if (rest.length === 0) {
102 return value;
103 }
104 if (value && typeof value === 'object' && value !== null) {
105 return getNestedValue(value as Record<string, unknown>, rest);
106 }
107 return undefined;
108}
109
110/**
111 * Get the effective value for a setting, considering inheritance from higher scopes

Callers 3

getEffectiveValueFunction · 0.85
settingExistsInScopeFunction · 0.85
saveModifiedSettingsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected