This lightweight npm package is used to easily generate a valid aliased email addressed. If a custom alias is not included in the function, a timestamp is used that is allowed in email configurations.
Install:
npm i aliased-email
Example:
aliasedEmail("[email protected]", "an alias")
// returns
"[email protected]"
aliasedEmail("[email protected]")
// returns
"[email protected]"
aliasedEmailObject("[email protected]")
// returns
{
alias: "2024-01-01T12.34.56"
aliasedEmail: "[email protected]",
createdAt: "2024-01-01T12:34:56.789Z",
email: "[email protected]",
error: false
}