Remove Boolean(url)

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
This commit is contained in:
Hung-Han (Henry) Chen committed 2021-07-08 10:38:37 +03:00
1 parent d2336d1e85
commit 7866ad8d5d
1 file changed
+5 -7
+5 -7
View File
@@ -27,14 +27,12 @@
* @return {boolean} * @return {boolean}
*/ */
export const isValidURL = (url: string | undefined | null) => { export const isValidURL = (url: string | undefined | null) => {
if (Boolean(url)) { try {
try { new URL(url);
new URL(url);
return true; return true;
} catch { } catch {
// ignore TypeError and return false // ignore TypeError and return false
}
} }
return false; return false;