How to use the prefix function from chance

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

118
119
120
121
122
123
124
125
126
127
  var m = {}, p = {}, prefix = '', name;
  if (opts.middle)
    m = opts.middle === 'full' ? {middle: true} : {middle_initial: true};
  if (opts.prefix) {
    p = helpers.mix(g, opts.prefix === 'full' ? {full: true} : {});
    prefix = chance.prefix(p) + ' ';
  }
  name = chance.name(helpers.mix(g, m));
  return prefix + name;
};
fork icon12
star icon33
watch icon3

+ 23 other calls in file

14
15
16
17
18
19
20
21
22
23

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

const person = {
    type: spec.label,
    prefix: chance.prefix({gender: gender }),
    first: chance.first({gender: gender}),
    last: chance.last(),
    age: chance.age(),
    birthday: chance.birthday({string: true, american: true}),
fork icon0
star icon1
watch icon0