fumadocs-core
Version:
The React.js library for building a documentation website
16 lines (15 loc) • 481 B
JavaScript
//#region src/utils/normalize-url.tsx
/**
* normalize URL into the Fumadocs standard form (`/slug-1/slug-2`).
*
* This includes URLs with trailing slashes.
*/
function normalizeUrl(url) {
if (url.startsWith("http://") || url.startsWith("https://")) return url;
if (!url.startsWith("/")) url = "/" + url;
if (url.length > 1 && url.endsWith("/")) url = url.slice(0, -1);
return url;
}
//#endregion
export { normalizeUrl as t };
//# sourceMappingURL=normalize-url-DP9-1I-S.js.map