前端对手机号脱敏
/**
* 手机号码脱敏
* @param { string } phone
* @return { String }
*/
function phoneNuberConvert (phone) {
if (!phone) return ""
let pat = /(\d{3})\d*(\d{4})/
let result = phone.replace(pat, "$1****$2")
return result
}
console.log(`手机号脱敏===> ${phoneNuberConvert("01234567890")}`); // 012****7890
标签:phoneNuberConvert,return,手机号,phone,let,脱敏
From: https://www.cnblogs.com/bingquan1/p/16858749.html