Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增函数:浏览器禁止切换页面 #20

Merged
merged 5 commits into from
Jul 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
添加手机号脱敏函数
  • Loading branch information
Nil-nil-zero committed Jul 30, 2024
commit 722e110ad7f9e45ab4a6b89633c45babef1edff1
16 changes: 16 additions & 0 deletions lib/yd_phone_Masking.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* 手机号脱敏
* @param {Function} fn 手机号脱敏的函数
* @param {number} delay 手机号
* @author Nil <https://github.com/Nil-nil-zero>
* @return {String}
*/
export function phone_Masking(number) {
if (!/^\d{11,}$/.test(number)) {
return '手机号码必须是11位数字';
}
const result = number.substring(0, 3) + '****' + number.substring(7);
return result;
}

console.log(phone_Masking('1312d3411211'));