mirror of
https://github.com/mashirozx/sakura.git
synced 2025-05-29 01:49:21 +08:00
14 lines
211 B
TypeScript
14 lines
211 B
TypeScript
export const isUrl = (url: string): { state: boolean; msg?: any } => {
|
|
try {
|
|
new URL(url)
|
|
} catch (error) {
|
|
return {
|
|
state: false,
|
|
msg: error,
|
|
}
|
|
}
|
|
return {
|
|
state: true,
|
|
}
|
|
}
|