@megaads/wm
Version:
To install the library, use npm:
24 lines (18 loc) • 500 B
text/typescript
// @ts-nocheck
function getCdn($url) {
if (!$url) return $url;
if (typeof $url !== 'string') return $url;
if ($url.startsWith('blob')) return $url;
if ($url.startsWith('http')) return $url;
let cleaned = $url.replace(/\/+/g, '/');
cleaned = cleaned.replace(/^\/+/, '');
return 'https://cdn.teeinblue.com/' + cleaned;
}
function isHttpUrl(url) {
const regex = /^https?:\/\/[^\s/$.?#].[^\s]*$/i;
return regex.test(url);
}
export {
getCdn,
isHttpUrl,
};