blob: ba043260faf5009ebf07a6863fffe153896e01c3 (
plain)
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
|
# phone
```js
// usage
chance.phone()
chance.phone({ formatted: false })
chance.phone({ country: "fr" })
chance.phone({ country: "fr", mobile: true })
```
Generate a random phone
```js
chance.phone();
=> '(494) 927-2152'
```
By default conforms to [NANP](http://en.wikipedia.org/wiki/North_American_Numbering_Plan) for a proper US phone number.
Optionally disable formatting.
```js
chance.phone({ formatted: false });
=> '2617613391'
```
Optionally specify a country.
```js
chance.phone({ country: 'fr' });
=> '01 60 44 92 67'
```
Note, at current we only have support for `'us'`, `'uk'`, or `'fr'` for countries.
For `uk` and `fr`, optionally specify a mobile phone.
```js
chance.phone({ country: 'uk', mobile: true });
=> '07624 321221'
```
|