Files
anonymous_github/src/core/url-utils.ts
T

6 lines
249 B
TypeScript

export function joinUrl(base: string, pathname: string): string {
const normalizedBase = base.endsWith("/") ? base : `${base}/`;
const normalizedPath = pathname.replace(/^\/+/, "");
return new URL(normalizedPath, normalizedBase).toString();
}