1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/lib/user.js

21 lines
468 B
JavaScript
Raw Normal View History

'use strict';
const gravatar = require('gravatar');
2018-01-17 09:27:47 +01:00
const Joi = require('joi');
module.exports = class User {
constructor({ name, email, imageUrl } = {}) {
2018-01-17 09:27:47 +01:00
Joi.assert(
email,
Joi.string()
.email()
.required(),
'Email'
);
this.email = email;
this.name = name;
this.imageUrl =
imageUrl || gravatar.url(email, { s: '42', d: 'retro' });
}
};