UNPKG

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