@mintlify/scraping
Version:
Scrape documentation frameworks to Mintlify docs
12 lines (9 loc) • 362 B
text/typescript
export function removeTrailingSlash(str: string): string {
return str.endsWith('/') ? str.substring(0, str.length - 1) : str;
}
export function removeLeadingSlash(str: string): string {
return str.startsWith('/') ? str.substring(1) : str;
}
export function optionallyAddLeadingSlash(str: string): string {
return str.startsWith('/') ? str : '/' + str;
}