diff --git a/src/Umbraco.Web.UI.Client/libs/router/generate-route-path-builder.function.ts b/src/Umbraco.Web.UI.Client/libs/router/generate-route-path-builder.function.ts index 98e0dbd653..50e591fbf2 100644 --- a/src/Umbraco.Web.UI.Client/libs/router/generate-route-path-builder.function.ts +++ b/src/Umbraco.Web.UI.Client/libs/router/generate-route-path-builder.function.ts @@ -1,16 +1,7 @@ -import type { ISlashOptions } from '@umbraco-cms/backoffice/router'; +import { stripSlash } from '@umbraco-cms/backoffice/router'; const PARAM_IDENTIFIER = /:([^\\/]+)/g; -function stripSlash(path: string): string { - return slashify(path, { start: false, end: false }); -} - -function slashify(path: string, { start = true, end = true }: Partial = {}): string { - path = start && !path.startsWith('/') ? `/${path}` : !start && path.startsWith('/') ? path.slice(1) : path; - return end && !path.endsWith('/') ? `${path}/` : !end && path.endsWith('/') ? path.slice(0, path.length - 1) : path; -} - export function generateRoutePathBuilder(path: string) { return (params: { [key: string]: string | number }) => stripSlash(