From 7866ad8d5d478acc493e86ae8f5398e048a78821 Mon Sep 17 00:00:00 2001 From: "Hung-Han (Henry) Chen" Date: Tue, 6 Jul 2021 16:25:31 +0300 Subject: [PATCH] Remove Boolean(url) Signed-off-by: Hung-Han (Henry) Chen --- src/common/utils/isValidURL.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/common/utils/isValidURL.ts b/src/common/utils/isValidURL.ts index df47f98f6b..cf106f34da 100644 --- a/src/common/utils/isValidURL.ts +++ b/src/common/utils/isValidURL.ts @@ -27,14 +27,12 @@ * @return {boolean} */ export const isValidURL = (url: string | undefined | null) => { - if (Boolean(url)) { - try { - new URL(url); + try { + new URL(url); - return true; - } catch { - // ignore TypeError and return false - } + return true; + } catch { + // ignore TypeError and return false } return false;