diff options
| author | JKillian <[email protected]> | 2014-12-09 16:22:03 -0500 |
|---|---|---|
| committer | JKillian <[email protected]> | 2014-12-09 16:22:03 -0500 |
| commit | 3ee7219df7a2d5353fe171b2c30b864d5e0c3a31 (patch) | |
| tree | eaf72113fea2f2bcfc449477f33f58907ea7d8fe /lib | |
| parent | daa9f442797525c9547c329665b4e9107b41d375 (diff) | |
| download | faker-3ee7219df7a2d5353fe171b2c30b864d5e0c3a31.tar.xz faker-3ee7219df7a2d5353fe171b2c30b864d5e0c3a31.zip | |
Add new jobTitle function to name object.
I had to make a few concessions when doing this.
Ideally I would have added this function under the 'company' module,
but I chose to add it to the 'name' object instead,
as the data happened to already exist in the locale files under
'name.title'.
However, I felt that the field names in the locale files were confusing,
so their wrappers in the name module are renamed for clarity.
For example, faker.name.jobArea() returns a random element from
locale.name.title.level. In my opinion, 'jobArea' was a much better
description of the data than 'level'.
Finally, fixed a bug in one unit test which didn't restore a function
to its original state after watching it.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/name.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/name.js b/lib/name.js index cb43e596..faa1151d 100644 --- a/lib/name.js +++ b/lib/name.js @@ -44,6 +44,12 @@ var _name = { return firstName + " " + lastName; }, + jobTitle: function () { + return faker.name.jobDescriptor() + " " + + faker.name.jobArea() + " " + + faker.name.jobType(); + }, + prefix: function () { return faker.random.array_element(faker.definitions.name.prefix); }, @@ -52,6 +58,20 @@ var _name = { return faker.random.array_element(faker.definitions.name.suffix); }, + jobDescriptor: function () { + return faker.random.array_element(faker.definitions.name.title.descriptor); + }, + + jobArea: function () { + return faker.random.array_element(faker.definitions.name.title.level); + }, + + jobType: function () { + return faker.random.array_element(faker.definitions.name.title.job); + } + + + }; module.exports = _name; |
