forked from zuriby/Faker.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
name.js
43 lines (34 loc) · 1.14 KB
/
name.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
var faker = require('../index');
var _name = {
firstName: function () {
return faker.random.array_element(faker.definitions.name.first_name)
},
//Working as intended
firstNameFemale: function () {
return faker.name.firstName();
},
//Working as intended
firstNameMale: function () {
return faker.name.firstName();
},
lastName: function () {
return faker.random.array_element(faker.definitions.name.last_name)
},
findName: function (name) {
var r = faker.random.number(8);
switch (r) {
case 0:
return faker.name.prefix() + " " + (name || faker.name.firstName()) + " " + faker.name.lastName();
case 1:
return (name || faker.name.firstName()) + " " + faker.name.lastName() + " " + faker.name.suffix();
}
return faker.name.firstName() + " " + faker.name.lastName();
},
prefix: function () {
return faker.random.array_element(faker.definitions.name.prefix);
},
suffix: function () {
return faker.random.array_element(faker.definitions.name.suffix);
},
};
module.exports = _name;