Created
February 23, 2023 09:00
-
-
Save EhsanHadid/6f9f8a01d532867b43dddacda764f822 to your computer and use it in GitHub Desktop.
phone util
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const convertPhoneToEmail = (phone: string) => { | |
// replacing special characters( +,-, (, ), and #. ) to alphabet chars | |
console.log(phone); | |
const cleanedPhone = phone | |
.replace("(", "A") | |
.replace(")", "B") | |
.replace(",", "C") | |
.replace("#", "D") | |
.replace(" ", "E"); | |
const email = `${cleanedPhone}@yourdomain.com`; | |
return email; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment