How to use the gender function from chance

Find comprehensive JavaScript chance.gender code examples handpicked from public code repositorys.

25
26
27
28
29
30
31
32
33
34
});

deferred.then(() => {
  console.log(); // eslint-disable-line no-console
  for (let i = 0; i < numPatients; i++) {
    const gender = Chance.gender();
    const omrsId = Chance.string({
      pool: REFAPP_OPENMRS_ID_CHARS,
    });
    const bday = Chance.birthday();
fork icon8
star icon16
watch icon5

+ 9 other calls in file

29
30
31
32
33
34
35
36
37
38
return User.build({
  firstName: chance.first(),
  lastName: chance.last(),
  isAdmin: false,
  email: emails.pop(),
  gender: chance.gender(),
  dob: chance.birthday({ string: true }),
  occupation: chance.pickone(['Sales', 'Hospitality', 'Healthcare', 'Custodial', 'Accounting', 'Teaching', 'Law-Enforcement', 'Law', 'Finance', 'Engineering', 'Administration', 'Student', 'Other']),
  incomeLevel: chance.weighted(['Under-$15,000', '$15,000-to-$24,999', '$25,000-to-$34,999', '$35,000-to-$49,999', '$50,000-to-$74,999', '$75,000-to-$99,999', '$100,000-to-$149,999', '$150,000-to-$199,999', '$200,000-and-over'], [11.6, 10.5, 10, 12.7, 16.7, 12.1, 14.1, 6.2, 6.1]),
  ethnicity: chance.weighted(['White', 'Black', 'Hispanic', 'Asian', 'American-Indian/Alaska-Native', 'Hawaiian/Other-Pacific-Islander', 'Other'], [61, 12, 18, 6, 1, 0, 2]),
fork icon3
star icon12
watch icon6

+ 3 other calls in file

146
147
148
149
150
151
152
153
154
155
    break;
case 'float':
    s += chance.floating();
    break;
case 'gender':
    s += chance.gender();
    break;
case 'guid':
    s += chance.guid();
    break;
fork icon2
star icon8
watch icon0

13
14
15
16
17
18
19
20
21
22
    return ch.pick(options)
}
exports.pick = exports.random
exports.firstName = function () { return ch.first() }
exports.lastName = function () { return ch.last() }
exports.gender = function () { return ch.gender() }
exports.company = function () { return ch.capitalize(ch.word({syllables: 3})) }
exports.email = function () { return ch.email() }
exports.phone = function () { return ch.phone() }
exports.address = function () { return ch.address() }
fork icon0
star icon2
watch icon1

+ 3 other calls in file

10
11
12
13
14
15
16
17
18
19
spec.label = 'people';   // usually plural
spec.list = [];

for( var i = 0; i < count; i++ ) {

    const gender = chance.gender().toLowerCase();

    const person = {
        type: spec.label,
        prefix: chance.prefix({gender: gender }),
fork icon0
star icon1
watch icon0