mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
12 lines
218 B
TypeScript
12 lines
218 B
TypeScript
|
export default function isValidHttpUrl(string: string): boolean {
|
||
|
let url;
|
||
|
|
||
|
try {
|
||
|
url = new URL(string);
|
||
|
} catch (_) {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
return url.protocol === "http:" || url.protocol === "https:";
|
||
|
}
|