MCPcopy Create free account
hub / github.com/angular-component/router / getPathSegments

Function getPathSegments

libs/router/src/lib/utils/path-parser.ts:19–22  ·  view source on GitHub ↗
(route: Route)

Source from the content-addressed store, hash-verified

17const NON_EXACT_END = `${WILDCARD}(?=${PATH_END}|${END})`; // match WILDCARD followed by PATH_END or END
18
19export function getPathSegments(route: Route): string[] {
20 const sanitizedPath = route.path.replace(/^\//, '').replace(/(?:\/$)/, '');
21 return sanitizedPath ? sanitizedPath.split('/') : [];
22}
23
24export const parsePath = (route: Route): RegExp => {
25 const segments = getPathSegments(route);

Callers 3

compareRoutesFunction · 0.90
parsePathFunction · 0.85
matchRouteFunction · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected