Skip to content

Commit 048d1d4

Browse files
committed
fix(utils): 修复 validateUrl 方法
1 parent 7e03e7a commit 048d1d4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

shared/utils/src/validate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { isString } from './is'
22

33
/** 简单验证 url 是否为合法 */
4-
export function validateUrl(url: any): boolean {
5-
if (!isString('string')) {
4+
export function validateUrl(url: unknown): boolean {
5+
if (!isString(url)) {
66
return false
77
}
88
try {
99
new URL(url)
1010
return true
11-
} catch (err) {
11+
} catch {
1212
return false
1313
}
1414
}

0 commit comments

Comments
 (0)