faker 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +4 -0
- package/dist/faker.js +4980 -1829
- package/dist/faker.min.js +1 -1
- package/lib/address.js +20 -1
- package/lib/finance.js +17 -1
- package/lib/helpers.js +10 -3
- package/lib/image.js +3 -0
- package/lib/image_providers/lorempicsum.js +108 -0
- package/lib/index.js +1 -1
- package/lib/locales/en/address/country_code.js +0 -1
- package/lib/locales/en/address/country_code_alpha_3.js +252 -0
- package/lib/locales/en/address/index.js +1 -0
- package/lib/locales/en/finance/currency.js +3 -3
- package/lib/locales/en_IND/phone_number/formats.js +12 -3
- package/lib/locales/fi/index.js +4 -0
- package/lib/locales/fi/name/female_first_name.js +52 -0
- package/lib/locales/fi/name/first_name.js +102 -0
- package/lib/locales/fi/name/index.js +7 -0
- package/lib/locales/fi/name/last_name.js +52 -0
- package/lib/locales/fi/name/male_first_name.js +52 -0
- package/lib/locales/fi/name/name.js +6 -0
- package/lib/locales/fr/address/city_name.js +1 -1
- package/lib/locales/fr/name/female_first_name.js +453 -0
- package/lib/locales/fr/name/index.js +2 -1
- package/lib/locales/fr/name/male_first_name.js +498 -0
- package/lib/locales/ja/index.js +2 -1
- package/lib/locales/ja/lorem/index.js +4 -0
- package/lib/locales/ja/lorem/supplemental.js +508 -0
- package/lib/locales/ja/lorem/words.js +511 -0
- package/lib/locales/pl/name/last_name.js +8 -0
- package/lib/locales/pt_BR/address/city_prefix.js +0 -5
- package/lib/locales/pt_BR/address/city_suffix.js +0 -4
- package/lib/locales/pt_BR/address/postcode.js +0 -1
- package/lib/locales/pt_BR/address/street_suffix.js +0 -2
- package/lib/locales/pt_BR/commerce/color.js +47 -0
- package/lib/locales/pt_BR/commerce/department.js +24 -0
- package/lib/locales/pt_BR/commerce/index.js +5 -0
- package/lib/locales/pt_BR/commerce/product_name.js +59 -0
- package/lib/locales/pt_BR/date/index.js +4 -0
- package/lib/locales/pt_BR/date/month.js +63 -0
- package/lib/locales/pt_BR/date/weekday.js +43 -0
- package/lib/locales/pt_BR/index.js +2 -0
- package/lib/locales/pt_BR/name/first_name.js +120 -42
- package/lib/locales/pt_PT/phone_number/formats.js +1 -0
- package/lib/locales/ru/index.js +1 -0
- package/lib/locales/ru/lorem/index.js +3 -0
- package/lib/locales/ru/lorem/words.js +191 -0
- package/lib/locales/ru/name/index.js +6 -5
- package/lib/locales/ru/name/title.js +42 -0
- package/lib/locales/sv/commerce/product_name.js +8 -8
- package/lib/locales/vi/address/city_root.js +40 -40
- package/lib/locales/vi/address/country.js +195 -0
- package/lib/locales/vi/address/index.js +2 -1
- package/lib/locales/vi/address/postcode.js +3 -0
- package/lib/locales/vi/cell_phone/formats.js +5 -6
- package/lib/locales/vi/date/index.js +4 -0
- package/lib/locales/vi/date/month.js +63 -0
- package/lib/locales/vi/date/weekday.js +43 -0
- package/lib/locales/vi/index.js +1 -0
- package/lib/locales/vi/phone_number/formats.js +1 -14
- package/lib/locales/zh_CN/phone_number/formats.js +3 -3
- package/lib/locales.js +1 -0
- package/lib/lorem.js +11 -4
- package/lib/name.js +10 -0
- package/lib/random.js +2 -2
- package/locale/fi.js +5 -0
- package/package.json +1 -1
- package/vendor/user-agent.js +2 -1
- package/lib/locales/fr/name/first_name.js +0 -91
- package/lib/locales/vi/address/county.js +0 -73
@@ -6,7 +6,7 @@ module["exports"] = {
|
|
6
6
|
"Intelligent",
|
7
7
|
"Söt",
|
8
8
|
"Otrolig",
|
9
|
-
"
|
9
|
+
"Fantastisk",
|
10
10
|
"Praktisk",
|
11
11
|
"Slimmad",
|
12
12
|
"Grym"
|
@@ -17,8 +17,8 @@ module["exports"] = {
|
|
17
17
|
"Trä",
|
18
18
|
"Betong",
|
19
19
|
"Plast",
|
20
|
-
"
|
21
|
-
"
|
20
|
+
"Bomull",
|
21
|
+
"Granit",
|
22
22
|
"Gummi",
|
23
23
|
"Latex"
|
24
24
|
],
|
@@ -27,10 +27,10 @@ module["exports"] = {
|
|
27
27
|
"Bil",
|
28
28
|
"Dator",
|
29
29
|
"Handskar",
|
30
|
-
"
|
31
|
-
"
|
32
|
-
"
|
33
|
-
"
|
34
|
-
"
|
30
|
+
"Byxor",
|
31
|
+
"Skjorta",
|
32
|
+
"Bord",
|
33
|
+
"Skor",
|
34
|
+
"Hatt"
|
35
35
|
]
|
36
36
|
};
|
@@ -1,65 +1,65 @@
|
|
1
1
|
module["exports"] = [
|
2
|
-
"
|
2
|
+
"An Giang",
|
3
|
+
"Bà Rịa-Vũng Tàu",
|
4
|
+
"Bạc Liêu",
|
3
5
|
"Bắc Kạn",
|
6
|
+
"Bắc Giang",
|
4
7
|
"Bắc Ninh",
|
8
|
+
"Bến Tre",
|
9
|
+
"Bình Dương",
|
10
|
+
"Bình Định",
|
11
|
+
"Bình Phước",
|
12
|
+
"Bình Thuận",
|
13
|
+
"Cà Mau",
|
5
14
|
"Cao Bằng",
|
15
|
+
"Cần Thơ",
|
16
|
+
"Đà Nẵng",
|
17
|
+
"Đắk Lắk",
|
18
|
+
"Đắk Nông",
|
6
19
|
"Điện Biên",
|
20
|
+
"Đồng Nai",
|
21
|
+
"Đồng Tháp",
|
22
|
+
"Gia Lai",
|
7
23
|
"Hà Giang",
|
8
24
|
"Hà Nam",
|
9
|
-
"Hà
|
25
|
+
"Hà Nội",
|
26
|
+
"Hà Tĩnh",
|
10
27
|
"Hải Dương",
|
11
|
-
"
|
28
|
+
"Hải Phòng",
|
29
|
+
"Hậu Giang",
|
12
30
|
"Hòa Bình",
|
31
|
+
"TP. Hồ Chí Minh",
|
13
32
|
"Hưng Yên",
|
33
|
+
"Khánh Hoà",
|
34
|
+
"Kiên Giang",
|
35
|
+
"Kon Tum",
|
14
36
|
"Lai Châu",
|
15
|
-
"Lào Cai",
|
16
37
|
"Lạng Sơn",
|
38
|
+
"Lào Cai",
|
39
|
+
"Lâm Đồng",
|
40
|
+
"Long An",
|
17
41
|
"Nam Định",
|
42
|
+
"Nghệ An",
|
18
43
|
"Ninh Bình",
|
44
|
+
"Ninh Thuận",
|
19
45
|
"Phú Thọ",
|
20
|
-
"Quảng Ninh",
|
21
|
-
"Sơn La",
|
22
|
-
"Thái Bình",
|
23
|
-
"Thái Nguyên",
|
24
|
-
"Tuyên Quang",
|
25
|
-
"Vĩnh Phúc",
|
26
|
-
"Yên Bái",
|
27
|
-
"TP Đà Nẵng",
|
28
|
-
"Bình Định",
|
29
|
-
"Đắk Lắk",
|
30
|
-
"Đắk Nông",
|
31
|
-
"Gia Lai",
|
32
|
-
"Hà Tĩnh",
|
33
|
-
"Khánh Hòa",
|
34
|
-
"Kon Tum",
|
35
|
-
"Nghệ An",
|
36
46
|
"Phú Yên",
|
37
47
|
"Quảng Bình",
|
38
48
|
"Quảng Nam",
|
39
49
|
"Quảng Ngãi",
|
50
|
+
"Quảng Ninh",
|
40
51
|
"Quảng Trị",
|
41
|
-
"Thanh Hóa",
|
42
|
-
"Thừa Thiên Huế",
|
43
|
-
"TP TP. Hồ Chí Minh",
|
44
|
-
"An Giang",
|
45
|
-
"Bà Rịa Vũng Tàu",
|
46
|
-
"Bạc Liêu",
|
47
|
-
"Bến Tre",
|
48
|
-
"Bình Dương",
|
49
|
-
"Bình Phước",
|
50
|
-
"Bình Thuận",
|
51
|
-
"Cà Mau",
|
52
|
-
"TP Cần Thơ",
|
53
|
-
"Đồng Nai",
|
54
|
-
"Đồng Tháp",
|
55
|
-
"Hậu Giang",
|
56
|
-
"Kiên Giang",
|
57
|
-
"Lâm Đồng",
|
58
|
-
"Long An",
|
59
|
-
"Ninh Thuận",
|
60
52
|
"Sóc Trăng",
|
53
|
+
"Sơn La",
|
61
54
|
"Tây Ninh",
|
55
|
+
"Thái Bình",
|
56
|
+
"Thái Nguyên",
|
57
|
+
"Thanh Hoá",
|
58
|
+
"Thừa Thiên-Huế",
|
62
59
|
"Tiền Giang",
|
63
60
|
"Trà Vinh",
|
64
|
-
"
|
61
|
+
"Tuyên Quang",
|
62
|
+
"Vĩnh Long",
|
63
|
+
"Vĩnh Phúc",
|
64
|
+
"Yên Bái"
|
65
65
|
];
|
@@ -0,0 +1,195 @@
|
|
1
|
+
module["exports"] = [
|
2
|
+
"Afghanistan",
|
3
|
+
"Ai Cập",
|
4
|
+
"Albania",
|
5
|
+
"Algérie",
|
6
|
+
"Andorra",
|
7
|
+
"Angola",
|
8
|
+
"Vương quốc Liên hiệp Anh và Bắc Ireland",
|
9
|
+
"Antigua và Barbuda",
|
10
|
+
"Áo",
|
11
|
+
"Ả Rập Xê Út",
|
12
|
+
"Argentina",
|
13
|
+
"Armenia",
|
14
|
+
"Azerbaijan",
|
15
|
+
"Ấn Độ",
|
16
|
+
"Bahamas",
|
17
|
+
"Bahrain",
|
18
|
+
"Bangladesh",
|
19
|
+
"Barbados",
|
20
|
+
"Belarus",
|
21
|
+
"Belize",
|
22
|
+
"Bénin",
|
23
|
+
"Bhutan",
|
24
|
+
"Bỉ",
|
25
|
+
"Bolivia",
|
26
|
+
"Bosna và Hercegovina",
|
27
|
+
"Botswana",
|
28
|
+
"Bồ Đào Nha",
|
29
|
+
"Bờ Biển Ngà",
|
30
|
+
"Brasil",
|
31
|
+
"Brunei",
|
32
|
+
"Bulgaria",
|
33
|
+
"Burkina Faso",
|
34
|
+
"Burundi",
|
35
|
+
"Cabo Verde",
|
36
|
+
"Các Tiểu Vương quốc Ả Rập Thống nhất",
|
37
|
+
"Cameroon",
|
38
|
+
"Campuchia",
|
39
|
+
"Canada",
|
40
|
+
"Chile",
|
41
|
+
"Colombia",
|
42
|
+
"Comoros",
|
43
|
+
"Cộng hòa Congo",
|
44
|
+
"Cộng hòa Dân chủ Congo",
|
45
|
+
"Costa Rica",
|
46
|
+
"Croatia",
|
47
|
+
"Cuba",
|
48
|
+
"Djibouti",
|
49
|
+
"Dominica",
|
50
|
+
"Cộng hòa Dominica",
|
51
|
+
"Đan Mạch",
|
52
|
+
"Đông Timor",
|
53
|
+
"Đức",
|
54
|
+
"Ecuador",
|
55
|
+
"El Salvador",
|
56
|
+
"Eritrea",
|
57
|
+
"Estonia",
|
58
|
+
"Ethiopia",
|
59
|
+
"Fiji",
|
60
|
+
"Gabon",
|
61
|
+
"Gambia",
|
62
|
+
"Ghana",
|
63
|
+
"Grenada",
|
64
|
+
"Gruzia",
|
65
|
+
"Guatemala",
|
66
|
+
"Guiné-Bissau",
|
67
|
+
"Guinea Xích Đạo",
|
68
|
+
"Guinée",
|
69
|
+
"Guyana",
|
70
|
+
"Haiti",
|
71
|
+
"Hà Lan",
|
72
|
+
"Hàn Quốc",
|
73
|
+
"Hoa Kỳ",
|
74
|
+
"Honduras",
|
75
|
+
"Hungary",
|
76
|
+
"Hy Lạp",
|
77
|
+
"Iceland",
|
78
|
+
"Indonesia",
|
79
|
+
"Iran",
|
80
|
+
"Iraq",
|
81
|
+
"Ireland",
|
82
|
+
"Israel",
|
83
|
+
"Jamaica",
|
84
|
+
"Jordan",
|
85
|
+
"Kazakhstan",
|
86
|
+
"Kenya",
|
87
|
+
"Kiribati",
|
88
|
+
"Kosovo",
|
89
|
+
"Kuwait",
|
90
|
+
"Kyrgyzstan",
|
91
|
+
"Lào",
|
92
|
+
"Latvia",
|
93
|
+
"Lesotho",
|
94
|
+
"Liban",
|
95
|
+
"Liberia",
|
96
|
+
"Libya",
|
97
|
+
"Liechtenstein",
|
98
|
+
"Litva",
|
99
|
+
"Luxembourg",
|
100
|
+
"Macedonia",
|
101
|
+
"Madagascar",
|
102
|
+
"Malaysia",
|
103
|
+
"Mali",
|
104
|
+
"Malta",
|
105
|
+
"Maroc",
|
106
|
+
"Quần đảo Marshall",
|
107
|
+
"Mauritanie",
|
108
|
+
"Mauritius",
|
109
|
+
"México",
|
110
|
+
"Micronesia",
|
111
|
+
"Moldova",
|
112
|
+
"Monaco",
|
113
|
+
"Mông Cổ",
|
114
|
+
"Montenegro",
|
115
|
+
"Mozambique",
|
116
|
+
"Myanmar",
|
117
|
+
"Namibia",
|
118
|
+
"Nam Sudan",
|
119
|
+
"Nam Phi",
|
120
|
+
"Nauru",
|
121
|
+
"Na Uy",
|
122
|
+
"Nepal",
|
123
|
+
"New Zealand",
|
124
|
+
"Nicaragua",
|
125
|
+
"Niger",
|
126
|
+
"Nigeria",
|
127
|
+
"Nga",
|
128
|
+
"Nhật Bản",
|
129
|
+
"Oman",
|
130
|
+
"Pakistan",
|
131
|
+
"Palau",
|
132
|
+
"Palestine",
|
133
|
+
"Panama",
|
134
|
+
"Papua New Guinea",
|
135
|
+
"Paraguay",
|
136
|
+
"Peru",
|
137
|
+
"Pháp",
|
138
|
+
"Phần Lan",
|
139
|
+
"Philippines",
|
140
|
+
"Qatar",
|
141
|
+
"România",
|
142
|
+
"Rwanda",
|
143
|
+
"Saint Kitts và Nevis",
|
144
|
+
"Saint Lucia",
|
145
|
+
"Saint Vincent và Grenadines",
|
146
|
+
"Samoa",
|
147
|
+
"San Marino",
|
148
|
+
"São Tomé và Príncipe",
|
149
|
+
"Séc",
|
150
|
+
"Sénégal",
|
151
|
+
"Serbia",
|
152
|
+
"Seychelles",
|
153
|
+
"Sierra Leone",
|
154
|
+
"Singapore",
|
155
|
+
"Síp",
|
156
|
+
"Slovakia",
|
157
|
+
"Slovenia",
|
158
|
+
"Solomon",
|
159
|
+
"Somalia",
|
160
|
+
"Sri Lanka",
|
161
|
+
"Sudan",
|
162
|
+
"Suriname",
|
163
|
+
"Swaziland",
|
164
|
+
"Syria",
|
165
|
+
"Tajikistan",
|
166
|
+
"Tanzania",
|
167
|
+
"Tây Ban Nha",
|
168
|
+
"Tchad",
|
169
|
+
"Thái Lan",
|
170
|
+
"Thổ Nhĩ Kỳ",
|
171
|
+
"Thụy Điển",
|
172
|
+
"Thụy Sĩ",
|
173
|
+
"Togo",
|
174
|
+
"Tonga",
|
175
|
+
"Triều Tiên",
|
176
|
+
"Trinidad và Tobago",
|
177
|
+
"Trung Quốc",
|
178
|
+
"Trung Phi",
|
179
|
+
"Tunisia",
|
180
|
+
"Turkmenistan",
|
181
|
+
"Tuvalu",
|
182
|
+
"Úc",
|
183
|
+
"Uganda",
|
184
|
+
"Ukraina",
|
185
|
+
"Uruguay",
|
186
|
+
"Uzbekistan",
|
187
|
+
"Vanuatu",
|
188
|
+
"Vatican",
|
189
|
+
"Venezuela",
|
190
|
+
"Việt Nam",
|
191
|
+
"Ý",
|
192
|
+
"Yemen",
|
193
|
+
"Zambia",
|
194
|
+
"Zimbabwe"
|
195
|
+
];
|
@@ -2,5 +2,6 @@ var address = {};
|
|
2
2
|
module['exports'] = address;
|
3
3
|
address.city_root = require("./city_root");
|
4
4
|
address.city = require("./city");
|
5
|
-
address.county = require("./county");
|
6
5
|
address.default_country = require("./default_country");
|
6
|
+
address.postcode = require("./postcode");
|
7
|
+
address.country = require("./country");
|
@@ -0,0 +1,63 @@
|
|
1
|
+
// Source: http://unicode.org/cldr/trac/browser/tags/release-27/common/main/en.xml#L1799
|
2
|
+
module["exports"] = {
|
3
|
+
wide: [
|
4
|
+
"Tháng Giêng",
|
5
|
+
"Tháng Hai",
|
6
|
+
"Tháng Ba",
|
7
|
+
"Tháng Tư",
|
8
|
+
"Tháng Năm",
|
9
|
+
"Tháng Sáu",
|
10
|
+
"Tháng Bảy",
|
11
|
+
"Tháng Tám",
|
12
|
+
"Tháng Chín",
|
13
|
+
"Tháng Mười",
|
14
|
+
"Tháng Mười Một",
|
15
|
+
"Tháng Mười Hai"
|
16
|
+
],
|
17
|
+
// Property "wide_context" is optional, if not set then "wide" will be used instead
|
18
|
+
// It is used to specify a word in context, which may differ from a stand-alone word
|
19
|
+
wide_context: [
|
20
|
+
"Tháng Giêng",
|
21
|
+
"Tháng Hai",
|
22
|
+
"Tháng Ba",
|
23
|
+
"Tháng Tư",
|
24
|
+
"Tháng Năm",
|
25
|
+
"Tháng Sáu",
|
26
|
+
"Tháng Bảy",
|
27
|
+
"Tháng Tám",
|
28
|
+
"Tháng Chín",
|
29
|
+
"Tháng Mười",
|
30
|
+
"Tháng Mười Một",
|
31
|
+
"Tháng Mười Hai"
|
32
|
+
],
|
33
|
+
abbr: [
|
34
|
+
"Tháng 1",
|
35
|
+
"Tháng 2",
|
36
|
+
"Tháng 3",
|
37
|
+
"Tháng 4",
|
38
|
+
"Tháng 5",
|
39
|
+
"Tháng 6",
|
40
|
+
"Tháng 7",
|
41
|
+
"Tháng 8",
|
42
|
+
"Tháng 9",
|
43
|
+
"Tháng 10",
|
44
|
+
"Tháng 11",
|
45
|
+
"Tháng 12"
|
46
|
+
],
|
47
|
+
// Property "abbr_context" is optional, if not set then "abbr" will be used instead
|
48
|
+
// It is used to specify a word in context, which may differ from a stand-alone word
|
49
|
+
abbr_context: [
|
50
|
+
"Tháng 1",
|
51
|
+
"Tháng 2",
|
52
|
+
"Tháng 3",
|
53
|
+
"Tháng 4",
|
54
|
+
"Tháng 5",
|
55
|
+
"Tháng 6",
|
56
|
+
"Tháng 7",
|
57
|
+
"Tháng 8",
|
58
|
+
"Tháng 9",
|
59
|
+
"Tháng 10",
|
60
|
+
"Tháng 11",
|
61
|
+
"Tháng 12"
|
62
|
+
]
|
63
|
+
};
|
@@ -0,0 +1,43 @@
|
|
1
|
+
// Source: http://unicode.org/cldr/trac/browser/tags/release-27/common/main/en.xml#L1847
|
2
|
+
module["exports"] = {
|
3
|
+
wide: [
|
4
|
+
"Chủ nhật",
|
5
|
+
"Thứ hai",
|
6
|
+
"Thứ ba",
|
7
|
+
"Thứ tư",
|
8
|
+
"Thứ năm",
|
9
|
+
"Thứ sáu",
|
10
|
+
"Thứ bảy"
|
11
|
+
],
|
12
|
+
// Property "wide_context" is optional, if not set then "wide" will be used instead
|
13
|
+
// It is used to specify a word in context, which may differ from a stand-alone word
|
14
|
+
wide_context: [
|
15
|
+
"Chủ nhật",
|
16
|
+
"Thứ hai",
|
17
|
+
"Thứ ba",
|
18
|
+
"Thứ tư",
|
19
|
+
"Thứ năm",
|
20
|
+
"Thứ sáu",
|
21
|
+
"Thứ bảy"
|
22
|
+
],
|
23
|
+
abbr: [
|
24
|
+
"CN",
|
25
|
+
"T2",
|
26
|
+
"T3",
|
27
|
+
"T4",
|
28
|
+
"T5",
|
29
|
+
"T6",
|
30
|
+
"T7",
|
31
|
+
],
|
32
|
+
// Property "abbr_context" is optional, if not set then "abbr" will be used instead
|
33
|
+
// It is used to specify a word in context, which may differ from a stand-alone word
|
34
|
+
abbr_context: [
|
35
|
+
"C.Nhật",
|
36
|
+
"Thứ 2",
|
37
|
+
"Thứ 3",
|
38
|
+
"Thứ 4",
|
39
|
+
"Thứ 5",
|
40
|
+
"Thứ 6",
|
41
|
+
"Thứ 7",
|
42
|
+
]
|
43
|
+
};
|
package/lib/locales/vi/index.js
CHANGED
@@ -1,17 +1,4 @@
|
|
1
1
|
module["exports"] = [
|
2
|
-
"01#### #####",
|
3
|
-
"01### ######",
|
4
|
-
"01#1 ### ####",
|
5
|
-
"011# ### ####",
|
6
2
|
"02# #### ####",
|
7
|
-
"
|
8
|
-
"055 #### ####",
|
9
|
-
"056 #### ####",
|
10
|
-
"0800 ### ####",
|
11
|
-
"08## ### ####",
|
12
|
-
"09## ### ####",
|
13
|
-
"016977 ####",
|
14
|
-
"01### #####",
|
15
|
-
"0500 ######",
|
16
|
-
"0800 ######"
|
3
|
+
"02## #### ####"
|
17
4
|
];
|
package/lib/locales.js
CHANGED
@@ -17,6 +17,7 @@ exports['en_ZA'] = require('./locales/en_ZA');
|
|
17
17
|
exports['es'] = require('./locales/es');
|
18
18
|
exports['es_MX'] = require('./locales/es_MX');
|
19
19
|
exports['fa'] = require('./locales/fa');
|
20
|
+
exports['fi'] = require('./locales/fi');
|
20
21
|
exports['fr'] = require('./locales/fr');
|
21
22
|
exports['fr_CA'] = require('./locales/fr_CA');
|
22
23
|
exports['fr_CH'] = require('./locales/fr_CH');
|
package/lib/lorem.js
CHANGED
@@ -8,13 +8,20 @@ var Lorem = function (faker) {
|
|
8
8
|
var Helpers = faker.helpers;
|
9
9
|
|
10
10
|
/**
|
11
|
-
* word
|
11
|
+
* generates a word of a specified length
|
12
12
|
*
|
13
13
|
* @method faker.lorem.word
|
14
|
-
* @param {number}
|
14
|
+
* @param {number} length length of the word that should be returned. Defaults to a random length
|
15
15
|
*/
|
16
|
-
self.word = function (
|
17
|
-
return
|
16
|
+
self.word = function (length) {
|
17
|
+
var hasRightLength = function(word) { return word.length === length; };
|
18
|
+
var properLengthWords;
|
19
|
+
if(typeof length === 'undefined') {
|
20
|
+
properLengthWords = faker.definitions.lorem.words;
|
21
|
+
} else {
|
22
|
+
properLengthWords = faker.definitions.lorem.words.filter(hasRightLength);
|
23
|
+
}
|
24
|
+
return faker.random.arrayElement(properLengthWords);
|
18
25
|
};
|
19
26
|
|
20
27
|
/**
|
package/lib/name.js
CHANGED
@@ -15,6 +15,16 @@ function Name (faker) {
|
|
15
15
|
if (typeof faker.definitions.name.male_first_name !== "undefined" && typeof faker.definitions.name.female_first_name !== "undefined") {
|
16
16
|
// some locale datasets ( like ru ) have first_name split by gender. since the name.first_name field does not exist in these datasets,
|
17
17
|
// we must randomly pick a name from either gender array so faker.name.firstName will return the correct locale data ( and not fallback )
|
18
|
+
|
19
|
+
if(typeof gender === 'string') {
|
20
|
+
if(gender.toLowerCase() === 'male') {
|
21
|
+
gender = 0;
|
22
|
+
}
|
23
|
+
else if(gender.toLowerCase() === 'female') {
|
24
|
+
gender = 1;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
18
28
|
if (typeof gender !== 'number') {
|
19
29
|
if(typeof faker.definitions.name.first_name === "undefined") {
|
20
30
|
gender = faker.random.number(1);
|
package/lib/random.js
CHANGED
@@ -202,8 +202,8 @@ function Random (faker, seed) {
|
|
202
202
|
|
203
203
|
// randomly pick from the many faker methods that can generate words
|
204
204
|
var randomWordMethod = faker.random.arrayElement(wordMethods);
|
205
|
-
|
206
|
-
|
205
|
+
var result = faker.fake('{{' + randomWordMethod + '}}');
|
206
|
+
return faker.random.arrayElement(result.split(' '));
|
207
207
|
}
|
208
208
|
|
209
209
|
/**
|
package/locale/fi.js
ADDED
package/package.json
CHANGED
package/vendor/user-agent.js
CHANGED
@@ -43,7 +43,8 @@ function rnd(a, b) {
|
|
43
43
|
|
44
44
|
if (Object.prototype.toString.call(a) === "[object Array]") {
|
45
45
|
//returns a random element from array (a), even weighting
|
46
|
-
|
46
|
+
var faker = require('../');
|
47
|
+
return faker.random.arrayElement(a);
|
47
48
|
}
|
48
49
|
|
49
50
|
if (a && typeof a === 'object') {
|