UNPKG

dl

Version:

DreamLab Libs

36 lines (33 loc) 805 B
/** * Description of Profile * * @param {Object} data Profile data * @constructor */ var NauthUserProfile = function (data) { this._data = data || {}; }; /** * Information whether user is logged * * @type Boolean */ NauthUserProfile.prototype.isLogged = function () { return this._data.hasOwnProperty('userId') && this._data.userId !== null; }; /** * Returns user data * * @returns {Object} User data: * {String} login - login (email/identity), * {Number} userId - unique identifier, * {Number} secondaryId - user mail account unique identifier. */ NauthUserProfile.prototype.toJSON = function () { return { login: this._data.login, userId: this._data.userId, secondaryId: this._data.secondaryId }; }; exports.NauthUserProfile = NauthUserProfile;