mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove Boolean(url)
Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
This commit is contained in:
parent
d2336d1e85
commit
7866ad8d5d
@ -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;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user