MCPcopy
hub / github.com/TanStack/router / removeTrailingSlash

Function removeTrailingSlash

packages/router-core/src/path.ts:46–51  ·  view source on GitHub ↗
(value: string, basepath: string)

Source from the content-addressed store, hash-verified

44
45/** Remove a trailing slash from value when appropriate for comparisons. */
46export function removeTrailingSlash(value: string, basepath: string): string {
47 if (value?.endsWith('/') && value !== '/' && value !== `${basepath}/`) {
48 return value.slice(0, -1)
49 }
50 return value
51}
52
53// intended to only compare path name
54// see the usage in the isActive under useLinkProps

Callers 5

path.test.tsFile · 0.90
useLinkPropsFunction · 0.90
useLinkPropsFunction · 0.90
useLinkPropsFunction · 0.90
exactPathTestFunction · 0.70

Calls 1

endsWithMethod · 0.80

Tested by

no test coverage detected