Skip to content

Commit

Permalink
adding more datasets to animal module
Browse files Browse the repository at this point in the history
added more common animals and associated tests. Added type for choosing random catagory by name
  • Loading branch information
RavsCodes20 committed Feb 16, 2021
1 parent 9ae74c5 commit 1914b96
Show file tree
Hide file tree
Showing 16 changed files with 2,940 additions and 2 deletions.
104 changes: 104 additions & 0 deletions lib/animal.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,110 @@ var Animal = function (faker) {
self.dog = function() {
return faker.random.arrayElement(faker.definitions.animal.dog);
};
/**
* cat
*
* @method faker.animal.cat
*/
self.cat = function() {
return faker.random.arrayElement(faker.definitions.animal.cat);
};
/**
* snake
*
* @method faker.animal.snake
*/
self.snake = function() {
return faker.random.arrayElement(faker.definitions.animal.snake);
};
/**
* bear
*
* @method faker.animal.bear
*/
self.bear = function() {
return faker.random.arrayElement(faker.definitions.animal.bear);
};
/**
* lion
*
* @method faker.animal.lion
*/
self.lion = function() {
return faker.random.arrayElement(faker.definitions.animal.lion);
};
/**
* cetacean
*
* @method faker.animal.cetacean
*/
self.cetacean = function() {
return faker.random.arrayElement(faker.definitions.animal.cetacean);
};
/**
* horse
*
* @method faker.animal.horse
*/
self.horse = function() {
return faker.random.arrayElement(faker.definitions.animal.horse);
};
/**
* bird
*
* @method faker.animal.bird
*/
self.bird = function() {
return faker.random.arrayElement(faker.definitions.animal.bird);
};
/**
* cow
*
* @method faker.animal.cow
*/
self.cow = function() {
return faker.random.arrayElement(faker.definitions.animal.cow);
};
/**
* fish
*
* @method faker.animal.fish
*/
self.fish = function() {
return faker.random.arrayElement(faker.definitions.animal.fish);
};
/**
* crocodilia
*
* @method faker.animal.crocodilia
*/
self.crocodilia = function() {
return faker.random.arrayElement(faker.definitions.animal.crocodilia);
};
/**
* insect
*
* @method faker.animal.insect
*/
self.insect = function() {
return faker.random.arrayElement(faker.definitions.animal.insect);
};
/**
* rabbit
*
* @method faker.animal.rabbit
*/
self.rabbit = function() {
return faker.random.arrayElement(faker.definitions.animal.rabbit);
};
/**
* type
*
* @method faker.animal.type
*/
self.type = function() {
return faker.random.arrayElement(faker.definitions.animal.type);
};

return self;
};
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function Faker (opts) {
var _definitions = {
"name": ["first_name", "last_name", "prefix", "suffix", "gender", "title", "male_prefix", "female_prefix", "male_first_name", "female_first_name", "male_middle_name", "female_middle_name", "male_last_name", "female_last_name"],
"address": ["city_prefix", "city_suffix", "street_suffix", "county", "country", "country_code", "country_code_alpha_3", "state", "state_abbr", "street_prefix", "postcode", "postcode_by_state", "direction", "direction_abbr", "time_zone"],
"animal": ["dog"],
"animal": ["dog", "cat", "snake", "bear", "lion", "cetacean", "insect", "crocodilia", "cow", "bird", "fish", "rabbit", "horse", "type"],
"company": ["adjective", "noun", "descriptor", "bs_adjective", "bs_noun", "bs_verb", "suffix"],
"lorem": ["words"],
"hacker": ["abbreviation", "adjective", "noun", "verb", "ingverb", "phrase"],
Expand Down
10 changes: 10 additions & 0 deletions lib/locales/en/animal/bear.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module["exports"] = [
"Giant panda",
"Spectacled bear",
"Sun bear",
"Sloth bear",
"American black bear",
"Asian black bear",
"Brown bear",
"Polar bear"
]
Loading

0 comments on commit 1914b96

Please sign in to comment.