1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
# Internet
[[toc]]
## Avatar
return random avatar url
```js
faker.internet.avatar();
// https://s3.amazonaws.com/uifaces/faces/twitter/dnezkumar/128.jpg
```
## Example E-mail <Badge type="tip" vertical="middle" text="Recommended" />
Generates random email address from [safe domains](https://en.wikipedia.org/wiki/Example.com)
::: tip
| Param | Type | Default |
| --------- | ------ | :----------------------: |
| firstName | string | `faker.name.firstName()` |
| lastName | string | `faker.name.lastName()` |
:::
```js
faker.internet.exampleEmail(); // [email protected]
faker.internet.exampleEmail('bob'); // [email protected]
faker.internet.exampleEmail('bob', 'jon'); // [email protected]
```
## E-mail <Badge type="danger" vertical="middle" text="Not recommended" />
Generates random email address
::: danger
This uses real domains so it is likely to create a "real" email address. Use `exampleEmail()` to be safe.
:::
::: tip
| Param | Type | Default |
| --------- | ------ | :-----------------------------------: |
| firstName | string | `faker.name.firstName()` |
| lastName | string | `faker.name.lastName()` |
| provider | string | `gmail.com` `yahoo.com` `hotmail.com` |
:::
```js
faker.internet.email(); // [email protected]
faker.internet.email('bob'); // [email protected]
faker.internet.email('bob', 'jon'); // [email protected]
faker.internet.email('bob', 'jon', 'somedomain.com'); // [email protected]
```
## User Name
Generates a username based on one of several patterns.
The pattern is chosen randomly from one of the following: `firstname#` `firstname.lastname` `firstname.lastname#` `firstnamelastname` `firstnamelastname#`
::: tip
| Param | Type | Default |
| --------- | ------ | :----------------------: |
| firstName | string | `faker.name.firstName()` |
| lastName | string | `faker.name.lastName()` |
:::
```js
faker.internet.userName(); // Maci12
faker.internet.userName('bob')); // bob_Considine30
faker.internet.userName('bob', 'jon')); // bob.jon61
```
## Protocol
Randomly generates http or https
```js
faker.internet.protocol(); // https
```
## URL
Generates a random URL. The URL could be secure or insecure.
```js
faker.internet.url(); // http://chloe.net
```
## Domain Name
Generates a random domain name.
```js
faker.internet.domainName(); // hailie.biz
```
## Domain Suffix
Generates a random domain suffix.
```js
faker.internet.domainSuffix(); // org
```
## Domain Word
Generates a random domain word.
```js
faker.internet.domainWord(); // mattie
```
## IP Address
Generates a random IP.
```js
faker.internet.ip(); // 165.20.179.86
```
## IPV6
Generates a random IPv6 address.
```js
faker.internet.ipv6(); // 0e1a:48d6:8da6:b933:be58:442d:71db:42d7
```
## User Agent
Generates a random user agent.
```js
faker.internet.userAgent();
// Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20100101 Firefox/6.0.0
```
## Hexadecimal Color
Generates a random hexadecimal color based on [this awesome response](http://stackoverflow.com/questions/43044/algorithm-to-randomly-generate-an-aesthetically-pleasing-color-palette)
::: tip
| Param | Type | Default |
| ------------ | ------ | :-----: |
| baseRed255 | number | `0` |
| baseGreen255 | number | `0` |
| baseBlue255 | number | `0` |
:::
```js
faker.internet.color(); // #630c7b
faker.internet.color(128); // #910145
faker.internet.color(122, 148); // #a06a09
faker.internet.color(42, 22, 11); // #48166d
```
## MAC Address
Generates a random mac address.
```js
faker.internet.mac(); // 00:87:14:24:31:ba
```
## Password
Generates a random password.
::: tip
| Param | Type | Default |
| --------- | ------- | :-----: |
| len | number | `15` |
| memorable | boolean | `false` |
| pattern | regex | `/\w/` |
| prefix | string | `''` |
**Note:** `pattern` param is ignored if memorable is set to `true`
:::
```js
faker.internet.password(); // 0ViHvR3Qp7AAsir
faker.internet.password(8); // m9Qw6dzR
faker.internet.password(8, true); // qecuquha
faker.internet.password(8, false, /^[A-Z]*$/); // PQGGVATB
faker.internet.password(8, false, /^[A-Z]*$/, 'bob'); // bobTXMPD
```
|