1
0
mirror of https://github.com/microsoft/TypeScript-Node-Starter.git synced 2025-11-08 16:17:37 +00:00

Change size existence check to default value

Using default value for size param in gravatar method is more convenient.
This commit is contained in:
Konrad Linkowski
2018-08-20 13:11:43 +02:00
committed by GitHub
parent a459d9b1c2
commit ca643b25b2

View File

@@ -77,10 +77,7 @@ userSchema.methods.comparePassword = comparePassword;
/**
* Helper method for getting user's gravatar.
*/
userSchema.methods.gravatar = function (size: number) {
if (!size) {
size = 200;
}
userSchema.methods.gravatar = function (size: number = 200) {
if (!this.email) {
return `https://gravatar.com/avatar/?s=${size}&d=retro`;
}