1 | # phone
|
2 |
|
3 | ```js
|
4 | // usage
|
5 | chance.phone()
|
6 | chance.phone({ formatted: false })
|
7 | chance.phone({ country: "fr" })
|
8 | chance.phone({ country: "fr", mobile: true })
|
9 | ```
|
10 |
|
11 | Generate a random phone
|
12 |
|
13 | ```js
|
14 | chance.phone();
|
15 | => '(494) 927-2152'
|
16 | ```
|
17 |
|
18 | By default conforms to [NANP](http://en.wikipedia.org/wiki/North_American_Numbering_Plan) for a proper US phone number.
|
19 |
|
20 | Optionally disable formatting.
|
21 |
|
22 | ```js
|
23 | chance.phone({ formatted: false });
|
24 | => '2617613391'
|
25 | ```
|
26 |
|
27 | Optionally specify a country.
|
28 |
|
29 | ```js
|
30 | chance.phone({ country: 'fr' });
|
31 | => '01 60 44 92 67'
|
32 | ```
|
33 |
|
34 | Note, at current we only have support for `'us'`, `'uk'`, or `'fr'` for countries.
|
35 |
|
36 | For `uk` and `fr`, optionally specify a mobile phone.
|
37 |
|
38 | ```js
|
39 | chance.phone({ country: 'uk', mobile: true });
|
40 | => '07624 321221'
|
41 | ```
|