wupengfei
4 天以前 022ae7305b51796cdd6bcd5eac7eef9e149898c3
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,13 @@
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');
};