mirror of
https://github.com/vastxie/99AI.git
synced 2025-09-17 09:16:38 +08:00
17 lines
541 B
JavaScript
17 lines
541 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.maskEmail = void 0;
|
|
function maskEmail(email) {
|
|
if (!email)
|
|
return '';
|
|
const atIndex = email.indexOf('@');
|
|
if (atIndex <= 1) {
|
|
return email;
|
|
}
|
|
const firstPart = email.substring(0, atIndex - 1);
|
|
const lastPart = email.substring(atIndex);
|
|
const maskedPart = '*'.repeat(firstPart.length - 1);
|
|
return `${firstPart.charAt(0)}${maskedPart}${email.charAt(atIndex - 1)}${lastPart}`;
|
|
}
|
|
exports.maskEmail = maskEmail;
|