removeTrailingSlash
Remove a trailing slash from a URL and return a new string, normalizing links so identical routes are not duplicated.
Usage
removeTrailingSlash removes the trailing slash from a URL.
import { removeTrailingSlash } from '@movk/core'
removeTrailingSlash('https://example.com/') // 'https://example.com'
removeTrailingSlash('https://example.com/path/') // 'https://example.com/path'
removeTrailingSlash('https://example.com') // 'https://example.com'
API
removeTrailingSlash(url)
Remove the trailing slash from a URL.
Parameters
url
string required
The URL string.
Returns
returns
string
The URL with the trailing slash removed.
Changelog
No recent changes