Last active
December 20, 2015 17:09
-
-
Save lvivier/6166735 to your computer and use it in GitHub Desktop.
Return an avatar from a FirebaseSimpleLogin user object.
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
/** | |
* Only CommonJS is cool | |
*/ | |
module.exports = avatar | |
/** | |
* Example: | |
* var avatar = require('avatar') | |
* var auth = new FirebaseSimpleLogin(db, function (err, user) { | |
* user.avatar = avatar(user) | |
* }) | |
*/ | |
function avatar (user) { | |
// TODO: gravatar from email for Persona and password | |
return (user.provider == 'facebook') ? | |
('http://graph.facebook.com/'+user.id+'/picture') : | |
user.profile_image_url || | |
user.avatar_url | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment