Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.map((childRoute): Route | null => {
const middlewares = [...parentMiddleware, ...childRoute.middleware];
const patterns = [route.pattern, childRoute.pattern];
if (childRoute.pattern && route.exact) {
console.warn(
`Error: ${route.pattern} is expected to be exact but its children ${childRoute.pattern} has a pattern, the child pattern will be ignored`
);
patterns[1] = null;
}
const pattern = Chemin.create(...patterns.filter(Chemin.isChemin));
const exact = route.exact || childRoute.exact;
const method = combineMethods(route.method, childRoute.method, m => {
console.warn(
`Error: in ${route.pattern} > ${route.pattern} the Method ${m} is not allowed by parent. It will be ignored !`
);
});
return createRoute({ pattern, exact, method }, middlewares, childRoute.children);
})
.filter((r: Route | null): r is Route => r !== null)