Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createRoute(
options: RouteOptions,
middleware: null | Middleware | Array,
children: Routes = []
): Route {
const { exact = true, method = null, pattern = null } = options;
const patternResolved = typeof pattern === 'string' ? Chemin.parse(pattern) : pattern;
return {
[ROUTE_TOKEN]: true,
pattern: patternResolved,
exact,
middleware: resolveMiddleware(middleware),
method,
children,
};
}