(value: string, basepath: string)
| 44 | |
| 45 | /** Remove a trailing slash from value when appropriate for comparisons. */ |
| 46 | export 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 |
no test coverage detected