9 lines
280 B
TypeScript
9 lines
280 B
TypeScript
export default function hideEmail(email: string) {
|
|
const atIndex = email.indexOf('@')
|
|
const username = email.substring(0, atIndex)
|
|
const domain = email.substring(atIndex + 1)
|
|
const hiddenUsername = `${username.substring(0, 2)}**`
|
|
|
|
return `${hiddenUsername}@${domain}`
|
|
}
|