UNPKG

@clerk/shared

Version:

Internal package utils used by the Clerk SDKs

19 lines (18 loc) • 561 B
//#region src/internal/clerk-js/oauthConsent.ts const IPV4_REGEX = /^(\d{1,3}\.){3}\d{1,3}$/; function getRedirectDisplay(url) { let hostname; try { hostname = new URL(url).hostname; } catch { return ""; } if (!hostname) return ""; const host = hostname.startsWith("[") && hostname.endsWith("]") ? hostname.slice(1, -1) : hostname; if (IPV4_REGEX.test(host)) return host; if (host.includes(":")) return `[${host}]`; return host.split(".").slice(-2).join("."); } //#endregion export { getRedirectDisplay }; //# sourceMappingURL=oauthConsent.mjs.map