From 69e0e3be99f9bb582add2bccaa154dd146b9313b Mon Sep 17 00:00:00 2001 From: zhengyiming <540361168@qq.com> Date: 星期五, 26 九月 2025 20:22:24 +0800 Subject: [PATCH] Merge branch 'dev-1.1.2' of http://120.26.58.240:8888/r/flexJobMiniApp into dev-1.1.2 --- packages/utils/common.ts | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/packages/utils/common.ts b/packages/utils/common.ts index e6344d5..a02170f 100644 --- a/packages/utils/common.ts +++ b/packages/utils/common.ts @@ -53,6 +53,7 @@ * @returns */ export function addStarForString(str: string, start = 0, end = 0) { + if (!str) return ''; return str.substring(0, start) + '*'.repeat(end - start) + str.substring(end); } @@ -129,3 +130,26 @@ export function filterJoin(list: any[], separator = '-') { return list.filter(Boolean).join(separator); } + +export const hiddenIDNumberForEnd6 = (realIDNumber: string) => { + if (!realIDNumber) return ''; + return realIDNumber.replace(/^(\d+)(.{6})$/, '$1******'); +}; + +export const showBankCodeForEnd4 = (bankCode: string) => { + if (!bankCode) return ''; + return '*'.repeat(Math.max(0, bankCode.length - 4)) + bankCode.slice(-4); +}; + +export const hiddenPhone = (phone: string) => { + if (!phone) return ''; + return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2'); +}; + +export function filterCN(str: string) { + return str.replace(/[\u4e00-\u9fa5]/gi, ''); +} + +export function filterNotCN(str: string) { + return str.replace(/[^\u4e00-\u9fa5]/gi, ''); +} -- Gitblit v1.9.1