-
Notifications
You must be signed in to change notification settings - Fork 0
/
metierUser.js
45 lines (34 loc) · 906 Bytes
/
metierUser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// partie Metier du PlayList (back)
// list of playlist
var listU = [];
function User (nomUser,idUser){
this.nomUser = nomUser;
this.idUser = idUser;
}
//ajouter an User
var ajouterUser = function (user) {
const idUser = listU.length;
listU[idUser] = new User(user.nomUser,idUser);
return listU[idUser];
}
//ajouter au user by name
var ajouterUserbyName = function (username) {
const idUser = listU.length;
listU[idUser] = new User(username,idUser);
return listU[idUser];
}
// Get an User by name
var getUser = function (nomUser) {
if (typeof listU[nomUser] === 'undefined') return {};
else {
return listU[nomUser];
}
}
//lister Users
var listerUser = function () {
return Object.values(listU);
}
exports.ajouterUser = ajouterUser;
exports.getUser = getUser;
exports.listerUser = listerUser;
exports.ajouterUserbyName = ajouterUserbyName;