mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-12 02:20:46 +08:00
🔨 Refactor: rewrite func isUrl
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user