{"size": 940, "ext": "js", "max_stars_repo_path": "helpers/UsersClass.js", "max_stars_repo_name": "zuber1077/Group_Chat", "max_stars_repo_stars_event_min_datetime": "2018-04-24T09:54:42.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-22T02:40:03.000Z", "max_issues_repo_path": "helpers/UsersClass.js", "max_issues_repo_name": "zuber1077/Group_Chat", "max_issues_repo_issues_event_min_datetime": "2018-06-20T15:28:33.000Z", "max_issues_repo_issues_event_max_datetime": "2018-06-23T04:06:20.000Z", "max_forks_repo_path": "helpers/UsersClass.js", "max_forks_repo_name": "zuber1077/Group_Chat", "max_forks_repo_forks_event_min_datetime": "2018-05-12T04:39:35.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-21T19:32:11.000Z"}
{"max_stars_count": 10, "max_issues_count": 1, "max_forks_count": 11, "avg_line_length": 25.4054054054, "max_line_length": 140, "alphanum_fraction": 0.5340425532}

class Users {
    constructor(){
        this.users = [];
    }
    // users online in group
    AddUserData(id, name, room){
        var users = {id, name, room}; //object disractury 
        this.users.push(users);
        return users;
    }
     //to remover from friend online list 
    RemoveUser(id){
        var user = this.GetUser(id);
        if(user){
            this.users = this.users.filter((user) => user.id !== id);
        }
        return user;
    }

    GetUser(id){
        var getUser = this.users.filter((userId)=> {
            //get all user id
            return userId.id === id;
        })[0];
        return getUser;
    }

    GetUsersList(room){
        var users = this.users.filter((user) => user.room === room ); //all room in z array that muches z room name be added into new array 
        var namesArray = users.map((user) => user.name );

        return namesArray;
    }
}

module.exports = {Users};