@payfit/unity-components
Version:
14 lines (13 loc) • 420 B
JavaScript
//#region src/components/link/utils.ts
function e(e) {
if (!e) return !1;
let t = (e) => e.startsWith("/") || e.startsWith("./") || e.startsWith("../") || e.startsWith("#"), n = (e) => e.includes("://");
try {
let r = new URL(e, window.location.origin);
return r.origin !== window.location.origin || n(r.pathname) ? !0 : !t(r.pathname);
} catch {
return !t(e);
}
}
//#endregion
export { e as isExternalUrl };