对身份证号脱敏处理
cardHide: (card) => {
const reg = /^(.{6})(?:\d+)(.{4})$/;
const maskedIdCard = card.replace(reg, '$1******$2');
return maskedIdCard;
},
对邮箱脱敏
emailHide: (email) => {
var avg;
var splitted;
var email1;
var email2;
splitted = email.split('@');
email1 = splitted[0];
avg = email1.length / 2;
email1 = email1.substring(0, email1.length - avg);
email2 = splitted[1];
return email1 + '***@' + email2;
},
对手机号脱敏
phoneHide: (phone) => {
let reg = /^(1[3-9][0-9])\d{4}(\d{4}$)/;
phone = phone.replace(reg, '$1****$2');
return phone;
}