Skip to content

Commit

Permalink
[ML] Replace .some() with for...of{}.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed May 4, 2020
1 parent 5acdc0c commit 9d6f488
Showing 1 changed file with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ export function getAggNameConflictToastMessages(
}

// check all aggs against new aggName
Object.keys(aggList).some(aggListName => {
for (const aggListName of Object.keys(aggList)) {
const aggListNameSplit = aggListName.split('.');
let aggListNameCheck: string;
return aggListNameSplit.some(aggListNamePart => {
let shouldBreak = false;
for (const aggListNamePart of aggListNameSplit) {
aggListNameCheck =
aggListNameCheck === undefined ? aggListNamePart : `${aggListNameCheck}.${aggListNamePart}`;
if (aggListNameCheck === aggName) {
Expand All @@ -66,21 +67,25 @@ export function getAggNameConflictToastMessages(
values: { aggName, aggListName },
})
);
return true;
shouldBreak = true;
break;
}
return false;
});
});
}
if (shouldBreak) {
break;
}
}

if (conflicts.length > 0) {
return conflicts;
}

// check all group-bys against new aggName
Object.keys(groupByList).some(groupByListName => {
for (const groupByListName of Object.keys(groupByList)) {
const groupByListNameSplit = groupByListName.split('.');
let groupByListNameCheck: string;
return groupByListNameSplit.some(groupByListNamePart => {
const shouldBreak = false;
for (const groupByListNamePart of groupByListNameSplit) {
groupByListNameCheck =
groupByListNameCheck === undefined
? groupByListNamePart
Expand All @@ -92,11 +97,14 @@ export function getAggNameConflictToastMessages(
values: { aggName, groupByListName },
})
);
return true;
shouldBreak = true;
break;
}
return false;
});
});
}
if (shouldBreak) {
break;
}
}

return conflicts;
}

0 comments on commit 9d6f488

Please sign in to comment.