Skip to main content

Function: maskEmail()

maskEmail(email): string
Defined in: crypto.ts:221 Mask an email address while preserving the domain — useful for deduplication and support workflows where the domain is non-PII but the local part identifies the user.

Parameters

email

string Full email. Falls back to maskPII if the input does not contain a valid local@domain shape.

Returns

string Masked email; e.g. "j*****[email protected]".

Example

maskEmail("[email protected]"); // → "j**[email protected]"
maskEmail("[email protected]");   // → "**@example.com"
maskEmail("not-an-email");     // → "no********il" (maskPII fallback)