diff options
| author | Richard Butler <[email protected]> | 2013-06-27 14:10:58 +0100 |
|---|---|---|
| committer | Richard Butler <[email protected]> | 2013-06-27 14:10:58 +0100 |
| commit | f2f37f8ef531798f30d8010b6a30a0bbc68875f4 (patch) | |
| tree | 3474af3e5eb94621f6c0def0759da0ad8b55b04c /lib/random.js | |
| parent | 1bd1d73d29222c4e2f52d63a4282345b63a324df (diff) | |
| download | faker-f2f37f8ef531798f30d8010b6a30a0bbc68875f4.tar.xz faker-f2f37f8ef531798f30d8010b6a30a0bbc68875f4.zip | |
Split male and female names into two groups
Diffstat (limited to 'lib/random.js')
| -rw-r--r-- | lib/random.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/random.js b/lib/random.js index 7d010109..9b82c6dc 100644 --- a/lib/random.js +++ b/lib/random.js @@ -48,8 +48,19 @@ var random = { return this.array_element(definitions.uk_country); }, - first_name: function () { - return this.array_element(definitions.first_name); + first_name: function ( gender ) { + var def; + + if ( typeof gender === "undefined" ) { + def = [].concat( + definitions.first_name.male, + definitions.first_name.female + ); + } else { + def = definitions.first_name[ gender ]; + } + + return this.array_element( def || [] ); }, last_name: function () { |
