Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function find(routes: Array, pathname: string): Array {
const parts = CheminUtils.splitPathname(pathname);
return routes
.map((route, index): FindResult | false => {
if (route.pattern === null) {
return {
route,
index,
params: {},
};
}
const match = route.pattern.match(parts);
if (match === false) {
return false;
}
if (route.exact && match.rest.length > 0) {
return false;