lib/models/users/matrix.js
function MatrixUser(userId, data, escape=true) {
    if (!userId) {
        throw new Error("Missing user_id");
    }
    if (data && Object.prototype.toString.call(data) !== "[object Object]") {
        throw new Error("data arg must be an Object");
    }
    this.userId = userId;
    const split = this.userId.split(":");
    this.localpart = split[0].substring(1);
    this.host = split[1];
    if (escape) {
        this.escapeUserId();
    }
    this._data = data || {};
}
function MatrixUser(userId, data, escape=true) {
    if (!userId) {
        throw new Error("Missing user_id");
    }
    if (data && Object.prototype.toString.call(data) !== "[object Object]") {
        throw new Error("data arg must be an Object");
    }
    this.userId = userId;
    const split = this.userId.split(":");
    this.localpart = split[0].substring(1);
    this.host = split[1];
    if (escape) {
        this.escapeUserId();
    }
    this._data = data || {};
}
function MatrixUser ( userId , data , escape = true ) { if ( ! userId ) { throw new Error ( "Missing user_id" ) ; } if ( data && Object . prototype . toString . call ( data ) !== "[object Object]" ) { throw new Error ( "data arg must be an Object" ) ; } this . userId = userId ; const split = this . userId . split ( ":" ) ; this . localpart = split [ 0 ] . substring ( 1 ) ; this . host = split [ 1 ] ; if ( escape ) { this . escapeUserId ( ) ; } this . _data = data || { } ; }
Construct a Matrix user.
@constructor
@param {string} userId The user_id of the user.
@param {Object=} data Serialized data values
@param {boolean} escape [true] Escape the user's localpart.
Construct a Matrix user .