/
member.js
45 lines (39 loc) · 893 Bytes
/
member.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
function toCheckmembership(inputMember) {
// the usersDatabase
const users = [
{
firstName: 'Vivion',
email: 'vivion@stark.com',
password: 'iamvivion'
},
{
firstName: 'Alex',
email: 'alex@hotmail.com',
password: 'alexleader'
},
{
firstName: 'Jerry',
email: 'jerry@parker.com',
password: 'iamjerry'
},
{
firstName: 'Tim',
email: 'tim@gamil.com',
password: '*tim#@$!'
},
{
firstName: 'Tom',
email: 'tom@shield.com',
password: 'tompassword'
}
]
//Check the inputMember
const isMember = users.find(user => (user.email === inputMember.email) && (user.password === inputMember.password))
if (isMember) {
return isMember
} else {
return false
}
}
// to export the toCheckmembership function to other files
module.exports = toCheckmembership