Skip to content

Commit 7cdda3a

Browse files
committed
adds email masker
1 parent 5e8bc85 commit 7cdda3a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

email-masker/emailMasker.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function maskEmail(email) {
2+
let symLocation = email.indexOf("@");
3+
let domainName = email.slice(symLocation + 1, email.length);
4+
let userName = email.slice (0, symLocation);
5+
//return userName + "@" + domainName;
6+
return `${userName[0]}${"*".repeat(userName.length-2)}${userName[userName.length-1]}@${domainName}`;
7+
}
8+
9+
let email = "apple.pie@example.com"
10+
11+
console.log(maskEmail(email));

0 commit comments

Comments
 (0)