1
1
import type { Faker } from '.' ;
2
2
3
+ /**
4
+ * Module to generate animal related entries.
5
+ */
3
6
export class Animal {
4
7
constructor ( private readonly faker : Faker ) {
5
8
// Bind `this` so namespaced is working correctly
@@ -14,6 +17,8 @@ export class Animal {
14
17
/**
15
18
* Returns a random dog breed.
16
19
*
20
+ * @example
21
+ * faker.animal.dog() // 'Irish Water Spaniel'
17
22
*/
18
23
dog ( ) : string {
19
24
return this . faker . random . arrayElement ( this . faker . definitions . animal . dog ) ;
@@ -22,6 +27,8 @@ export class Animal {
22
27
/**
23
28
* Returns a random cat breed.
24
29
*
30
+ * @example
31
+ * faker.animal.cat() // 'Singapura'
25
32
*/
26
33
cat ( ) : string {
27
34
return this . faker . random . arrayElement ( this . faker . definitions . animal . cat ) ;
@@ -30,6 +37,8 @@ export class Animal {
30
37
/**
31
38
* Returns a random snake species.
32
39
*
40
+ * @example
41
+ * faker.animal.snake() // 'Eyelash viper'
33
42
*/
34
43
snake ( ) : string {
35
44
return this . faker . random . arrayElement ( this . faker . definitions . animal . snake ) ;
@@ -38,6 +47,8 @@ export class Animal {
38
47
/**
39
48
* Returns a random bear species.
40
49
*
50
+ * @example
51
+ * faker.animal.bear() // 'Asian black bear'
41
52
*/
42
53
bear ( ) : string {
43
54
return this . faker . random . arrayElement ( this . faker . definitions . animal . bear ) ;
@@ -46,6 +57,8 @@ export class Animal {
46
57
/**
47
58
* Returns a random lion species.
48
59
*
60
+ * @example
61
+ * faker.animal.lion() // 'Northeast Congo Lion'
49
62
*/
50
63
lion ( ) : string {
51
64
return this . faker . random . arrayElement ( this . faker . definitions . animal . lion ) ;
@@ -54,7 +67,8 @@ export class Animal {
54
67
/**
55
68
* Returns a random cetacean species.
56
69
*
57
- * @method faker.animal.cetacean
70
+ * @example
71
+ * faker.animal.cetacean() // 'Spinner Dolphin'
58
72
*/
59
73
cetacean ( ) : string {
60
74
return this . faker . random . arrayElement (
@@ -65,6 +79,8 @@ export class Animal {
65
79
/**
66
80
* Returns a random horse breed.
67
81
*
82
+ * @example
83
+ * faker.animal.horse() // 'Swedish Warmblood'
68
84
*/
69
85
horse ( ) : string {
70
86
return this . faker . random . arrayElement ( this . faker . definitions . animal . horse ) ;
@@ -73,6 +89,8 @@ export class Animal {
73
89
/**
74
90
* Returns a random bird species.
75
91
*
92
+ * @example
93
+ * faker.animal.bird() // 'Buller's Shearwater'
76
94
*/
77
95
bird ( ) : string {
78
96
return this . faker . random . arrayElement ( this . faker . definitions . animal . bird ) ;
@@ -81,6 +99,8 @@ export class Animal {
81
99
/**
82
100
* Returns a random cow species.
83
101
*
102
+ * @example
103
+ * faker.animal.cow() // 'Brava'
84
104
*/
85
105
cow ( ) : string {
86
106
return this . faker . random . arrayElement ( this . faker . definitions . animal . cow ) ;
@@ -89,6 +109,8 @@ export class Animal {
89
109
/**
90
110
* Returns a random fish species.
91
111
*
112
+ * @example
113
+ * faker.animal.fish() // 'Mandarin fish'
92
114
*/
93
115
fish ( ) : string {
94
116
return this . faker . random . arrayElement ( this . faker . definitions . animal . fish ) ;
@@ -97,6 +119,8 @@ export class Animal {
97
119
/**
98
120
* Returns a random crocodilian species.
99
121
*
122
+ * @example
123
+ * faker.animal.crocodilia() // 'Philippine Crocodile'
100
124
*/
101
125
crocodilia ( ) : string {
102
126
return this . faker . random . arrayElement (
@@ -107,14 +131,18 @@ export class Animal {
107
131
/**
108
132
* Returns a random insect species.
109
133
*
134
+ * @example
135
+ * faker.animal.insect() // 'Pyramid ant'
110
136
*/
111
137
insect ( ) : string {
112
138
return this . faker . random . arrayElement ( this . faker . definitions . animal . insect ) ;
113
139
}
114
140
115
141
/**
116
- * Returns a random rabbit species
142
+ * Returns a random rabbit species.
117
143
*
144
+ * @example
145
+ * faker.animal.rabbit() // 'Florida White'
118
146
*/
119
147
rabbit ( ) : string {
120
148
return this . faker . random . arrayElement ( this . faker . definitions . animal . rabbit ) ;
@@ -123,6 +151,8 @@ export class Animal {
123
151
/**
124
152
* Returns a random animal type.
125
153
*
154
+ * @example
155
+ * faker.animal.type() // 'crocodilia'
126
156
*/
127
157
type ( ) : string {
128
158
return this . faker . random . arrayElement ( this . faker . definitions . animal . type ) ;
0 commit comments