in glean/src/core/storage.ts [92:111]
export function getValueFromNestedObject(obj: JSONObject, index: StorageIndex): JSONValue | undefined {
if (index.length === 0) {
throw Error("The index must contain at least one property to get.");
}
let target: JSONValue = obj;
for (const key of index) {
if (isObject(target) && key in target) {
const temp: unknown = target[key];
if (isJSONValue(temp)) {
target = temp;
}
} else {
// Bailing out because the full target path doesn't exist.
return;
}
}
return target;
}