continue-custom/core/util/url.ts
2025-02-27 15:03:27 -08:00

11 lines
210 B
TypeScript

export function canParseUrl(url: string): boolean {
if ((URL as any)?.canParse) {
return (URL as any).canParse(url);
}
try {
new URL(url);
return true;
} catch (e) {
return false;
}
}