UNPKG

@clerk/shared

Version:

Internal package utils used by the Clerk SDKs

1 lines 1.02 kB
{"version":3,"sources":["../src/proxy.ts"],"sourcesContent":["export function isValidProxyUrl(key: string | undefined) {\n if (!key) {\n return true;\n }\n\n return isHttpOrHttps(key) || isProxyUrlRelative(key);\n}\n\nexport function isHttpOrHttps(key: string | undefined) {\n return /^http(s)?:\\/\\//.test(key || '');\n}\n\nexport function isProxyUrlRelative(key: string) {\n return key.startsWith('/');\n}\n\nexport function proxyUrlToAbsoluteURL(url: string | undefined): string {\n if (!url) {\n return '';\n }\n return isProxyUrlRelative(url) ? new URL(url, window.location.origin).toString() : url;\n}\n"],"mappings":";AAAO,SAAS,gBAAgB,KAAyB;AACvD,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AAEA,SAAO,cAAc,GAAG,KAAK,mBAAmB,GAAG;AACrD;AAEO,SAAS,cAAc,KAAyB;AACrD,SAAO,iBAAiB,KAAK,OAAO,EAAE;AACxC;AAEO,SAAS,mBAAmB,KAAa;AAC9C,SAAO,IAAI,WAAW,GAAG;AAC3B;AAEO,SAAS,sBAAsB,KAAiC;AACrE,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AACA,SAAO,mBAAmB,GAAG,IAAI,IAAI,IAAI,KAAK,OAAO,SAAS,MAAM,EAAE,SAAS,IAAI;AACrF;","names":[]}