2023-11-09 09:26:37 +08:00
|
|
|
/**
|
|
|
|
* @param {string} path
|
|
|
|
* @returns {Boolean}
|
|
|
|
*/
|
|
|
|
export function isExternal(path: string) {
|
|
|
|
return /^(https?:|mailto:|tel:)/.test(path)
|
|
|
|
}
|
2023-12-18 18:52:49 +08:00
|
|
|
|
|
|
|
//电话
|
|
|
|
export function isPhone(data: string) {
|
|
|
|
return /^1[3|4|5|7|8][0-9]{9}$/.test(data)
|
|
|
|
}
|
|
|
|
|
|
|
|
//身份号
|
|
|
|
export function isIdCard(data: string ){
|
|
|
|
return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(data)
|
|
|
|
}
|
|
|
|
|
|
|
|
//邮箱
|
|
|
|
export function isEmail(data: string) {
|
|
|
|
return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/.test(data)
|
|
|
|
}
|
|
|
|
|