mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-01-23 14:48:13 -05:00
🔨 Refactor: rewrite func isUrl
This commit is contained in:
parent
b42c8608bc
commit
d0362e226e
@ -1,4 +1,12 @@
|
||||
export const isUrl = (url: string): boolean => (/^https?:\/\//.test(url))
|
||||
export const isUrl = (url: string): boolean => {
|
||||
try {
|
||||
new URL(url)
|
||||
return true
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export const isUrlEncode = (url: string): boolean => {
|
||||
url = url || ''
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user