Skip to content

Commit 1914b96

Browse files
committed
adding more datasets to animal module
added more common animals and associated tests. Added type for choosing random catagory by name
1 parent 9ae74c5 commit 1914b96

16 files changed

Lines changed: 2940 additions & 2 deletions

File tree

lib/animal.js

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,110 @@ var Animal = function (faker) {
1313
self.dog = function() {
1414
return faker.random.arrayElement(faker.definitions.animal.dog);
1515
};
16+
/**
17+
* cat
18+
*
19+
* @method faker.animal.cat
20+
*/
21+
self.cat = function() {
22+
return faker.random.arrayElement(faker.definitions.animal.cat);
23+
};
24+
/**
25+
* snake
26+
*
27+
* @method faker.animal.snake
28+
*/
29+
self.snake = function() {
30+
return faker.random.arrayElement(faker.definitions.animal.snake);
31+
};
32+
/**
33+
* bear
34+
*
35+
* @method faker.animal.bear
36+
*/
37+
self.bear = function() {
38+
return faker.random.arrayElement(faker.definitions.animal.bear);
39+
};
40+
/**
41+
* lion
42+
*
43+
* @method faker.animal.lion
44+
*/
45+
self.lion = function() {
46+
return faker.random.arrayElement(faker.definitions.animal.lion);
47+
};
48+
/**
49+
* cetacean
50+
*
51+
* @method faker.animal.cetacean
52+
*/
53+
self.cetacean = function() {
54+
return faker.random.arrayElement(faker.definitions.animal.cetacean);
55+
};
56+
/**
57+
* horse
58+
*
59+
* @method faker.animal.horse
60+
*/
61+
self.horse = function() {
62+
return faker.random.arrayElement(faker.definitions.animal.horse);
63+
};
64+
/**
65+
* bird
66+
*
67+
* @method faker.animal.bird
68+
*/
69+
self.bird = function() {
70+
return faker.random.arrayElement(faker.definitions.animal.bird);
71+
};
72+
/**
73+
* cow
74+
*
75+
* @method faker.animal.cow
76+
*/
77+
self.cow = function() {
78+
return faker.random.arrayElement(faker.definitions.animal.cow);
79+
};
80+
/**
81+
* fish
82+
*
83+
* @method faker.animal.fish
84+
*/
85+
self.fish = function() {
86+
return faker.random.arrayElement(faker.definitions.animal.fish);
87+
};
88+
/**
89+
* crocodilia
90+
*
91+
* @method faker.animal.crocodilia
92+
*/
93+
self.crocodilia = function() {
94+
return faker.random.arrayElement(faker.definitions.animal.crocodilia);
95+
};
96+
/**
97+
* insect
98+
*
99+
* @method faker.animal.insect
100+
*/
101+
self.insect = function() {
102+
return faker.random.arrayElement(faker.definitions.animal.insect);
103+
};
104+
/**
105+
* rabbit
106+
*
107+
* @method faker.animal.rabbit
108+
*/
109+
self.rabbit = function() {
110+
return faker.random.arrayElement(faker.definitions.animal.rabbit);
111+
};
112+
/**
113+
* type
114+
*
115+
* @method faker.animal.type
116+
*/
117+
self.type = function() {
118+
return faker.random.arrayElement(faker.definitions.animal.type);
119+
};
16120

17121
return self;
18122
};

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function Faker (opts) {
107107
var _definitions = {
108108
"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"],
109109
"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"],
110-
"animal": ["dog"],
110+
"animal": ["dog", "cat", "snake", "bear", "lion", "cetacean", "insect", "crocodilia", "cow", "bird", "fish", "rabbit", "horse", "type"],
111111
"company": ["adjective", "noun", "descriptor", "bs_adjective", "bs_noun", "bs_verb", "suffix"],
112112
"lorem": ["words"],
113113
"hacker": ["abbreviation", "adjective", "noun", "verb", "ingverb", "phrase"],

lib/locales/en/animal/bear.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module["exports"] = [
2+
"Giant panda",
3+
"Spectacled bear",
4+
"Sun bear",
5+
"Sloth bear",
6+
"American black bear",
7+
"Asian black bear",
8+
"Brown bear",
9+
"Polar bear"
10+
]

0 commit comments

Comments
 (0)