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

22 lines
542 B
JavaScript

'use strict';
const gravatarUrl = require('gravatar-url');
const Joi = require('@hapi/joi');
module.exports = class User {
constructor({ name, email, permissions, imageUrl } = {}) {
Joi.assert(
email,
Joi.string()
.email()
.required(),
'Email'
);
this.email = email;
this.name = name;
this.permissions = permissions;
this.imageUrl =
imageUrl || gravatarUrl(email, { size: '42', default: 'retro' });
}
};