隐藏邮箱
/**
* @description 隐藏邮箱号
* @param {*} email
* @returns email
*/
const hideEmailInfo= email => {
if (String (email).indexOf ('@') > 0) {
let newEmail, str = email.split('@'), _s = '';
if (str[0].length > 4) {
_s = str[0].substr (0, 4);
for (let i = 0; i < str[0].length - 4; i++) {
_s += '*';
}
} else {
_s = str[0].substr (0, 1);
for (let i = 0; i < str[0].length - 1; i++) {
_s += '*';
}
}
newEmail = _s + '@' + str[1];
return newEmail;
} else {
return email;
}
};
export default hideEmailInfo
隐藏手机号中间4位数
/**
* @description 隐藏手机号中间4位数
* @param {*} mobile
* @returns mobile
*/
const hideMobileInfo = mobile => {
let newMobile = '';
if (mobile.length > 7) {
newMobile=mobile.substr(0, 3) + '****' + mobile.substr(7);
return newMobile;
} else {
return mobile;
}
}
export default hideEmailInfo
网友评论