in scripts/generateTemplates.js [339:372]
function getValueFromPath(paths, obj) {
const keyPaths = [];
for (var i = 0; i < paths.length; i++) {
var currentKey = paths[i];
if (Array.isArray(obj) && !isNumeric(currentKey)) { // If a key is not a number but comes after an array, check if its a unique identifer
const previousKey = i > 0 ? paths[i - 1] : "";
var index;
if (Object.keys(ArrayLocIdentifier).includes(previousKey)) {
index = obj.findIndex(o => {
const id = o[ArrayLocIdentifier[previousKey]];
if (id) {
const alphaNumericId = removeNonAplhaNumeric(id);
const compare = alphaNumericId.localeCompare(currentKey);
return compare === 0;
} else {
return false;
}
});
if (index !== -1) {
currentKey = index.toString();
}
}
}
if (obj[currentKey]) {
obj = obj[currentKey];
keyPaths.push(currentKey);
} else {
// value does not exist, template may have been updated
return { out: null, paths: [] };
}
}
return { out: obj, paths: keyPaths };
}