Fix linter suggestions

This commit is contained in:
Gabe Kangas
2021-02-16 11:41:24 -08:00
parent ea965847dc
commit 8bd7c77a11
4 changed files with 6 additions and 6 deletions

View File

@@ -1,14 +1,14 @@
export function isValidUrl(url: string): boolean {
export default function isValidUrl(url: string): boolean {
const validProtocols = ['http:', 'https:'];
try {
const validationObject = new URL(url);
if (validationObject.protocol === '' || validationObject.hostname === '' || !validProtocols.includes(validationObject.protocol)) {
return false
return false;
}
} catch(e) {
return false;
}
return true
return true;
}