mirror of
https://github.com/sergeyyarkov/asu_tools_service.git
synced 2026-10-11 10:29:22 +03:00
15 lines
319 B
JavaScript
15 lines
319 B
JavaScript
/**
|
|
* @param {string} pathname
|
|
*/
|
|
export function matchRoutePathname(pathname) {
|
|
return pathname.match(/(^\/[^/].*$|^\/$)/g);
|
|
}
|
|
|
|
/**
|
|
* @param {string} pathname
|
|
*/
|
|
export function formatRoutePathname(pathname) {
|
|
if (pathname[0] !== "/") pathname = "/" + pathname;
|
|
return pathname.replaceAll(/\/{2,}/g, "/");
|
|
}
|