Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getRouteParams(match, routeMatches) {
return accumulateRouteValues(
routeMatches,
match.routeIndices,
(params, routeMatch) => {
const { route, routeParams } = routeMatch;
// We need to always run this to make sure we don't miss route params.
let nextParams = { ...params, ...routeParams };
if (route.prepareParams) {
nextParams = route.prepareParams(nextParams, routeMatch);
}
return nextParams;
},
null,
);
}
getRouteVariables(match, routeMatches) {
return accumulateRouteValues(
routeMatches,
match.routeIndices,
(variables, routeMatch) => {
const { route, routeParams } = routeMatch;
// We need to always run this to make sure we don't miss route params.
let nextVariables = { ...variables, ...routeParams };
if (route.prepareVariables) {
nextVariables = route.prepareVariables(nextVariables, routeMatch);
}
return nextVariables;
},
null,
);
}