Created
May 14, 2020 11:58
-
-
Save josemunozr/fa4adcd781275ba04f0c11ff13754049 to your computer and use it in GitHub Desktop.
gravatar.js
This file contains 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
import md5 from 'md5'; | |
const gravatar = (email) => { | |
const base = 'https://gravatar.com/avatar/'; | |
const formattedEmail = email.trim().toLowerCase(); | |
const hash = md5(formattedEmail, { encoding: 'binary' }); | |
return `${base}${hash}`; | |
}; | |
export default gravatar; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment