Fix linter suggestions
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user