Skip to content

Commit

Permalink
AB#46862: Refactor route filtering logic (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
e-halinen committed Nov 19, 2024
1 parent 9b8e943 commit 4f85bd4
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/util/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,16 +286,19 @@ function routeGeneralizer(routes) {
function filterRoute(props) {
const { filter } = props;
const { routeId } = props;
const routeIdParsed = trimRouteId(routeId);
if (!filter) {
return true;
}
for (let i = 0; i < filter.length; i++) {
const char = filter[i];
if (char !== '*' && char === routeId[i]) {
return false;

const filteredRoutes = filter.split(',').map(routeIdToFilter => routeIdToFilter.trim());
let routeMatchesFilter = false;
filteredRoutes.forEach(filterRouteId => {
if (routeId.includes(filterRouteId) && filterRouteId === routeIdParsed) {
routeMatchesFilter = true;
}
}
return true;
});
return !routeMatchesFilter;
}

export {
Expand Down

0 comments on commit 4f85bd4

Please sign in to comment.