mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-11-14 00:07:00 +01:00
6 lines
249 B
TypeScript
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();
|
|
}
|