How can I modify this code so that I can grab the field.DependencyFieldEvaluated value and get out of the function as soon I get this value?
function discoverDependentFields(fields) {
fields.forEach(function (field) {
if (field.DependencyField) {
var foundFields = fields.filter(function (fieldToFind) { return fieldToFind.Name === field.DependencyField; });
if (foundFields.length === 1) {
return field.DependencyFieldEvaluated = foundFields[0];
}
}
});
}