From 60364392f6ea6b260d620a5f778aa9ecf28cb89e Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期二, 23 九月 2025 10:38:32 +0800
Subject: [PATCH] Merge branch 'dev-v1.1'
---
packages/utils/common.ts | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/packages/utils/common.ts b/packages/utils/common.ts
index e6344d5..a420b99 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,21 @@
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 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.10.0