Faker v0.7.0 Faker.Phone.EnUs

This follows the rules outlined in the North American Numbering Plan at https://en.wikipedia.org/wiki/North_American_Numbering_Plan.

The NANP number format may be summarized in the notation NPA-NXX-xxxx:

The allowed ranges for NPA (area code) are: [2–9] for the first digit, and [0-9] for the second and third digits. The NANP is not assigning area codes with 9 as the second digit.

The allowed ranges for NXX (central office/exchange) are: [2–9] for the first digit, and [0–9] for both the second and third digits (however, in geographic area codes the third digit of the exchange cannot be 1 if the second digit is also 1).

The allowed ranges for xxxx (subscriber number) are [0–9] for each of the four digits.

Summary

Functions

Returns a random area code

Returns a random exchange code

Returns a random extension n digits long

Returns a random US phone number

Returns a random subscriber number n digits long

Functions

area_code()

Specs

area_code :: String.t

Returns a random area code

exchange_code()

Specs

exchange_code :: String.t

Returns a random exchange code

extension(n)

Returns a random extension n digits long

phone()

Specs

phone :: String.t

Returns a random US phone number

Possible returned formats:

(123) 456-7890 123/456-7890 123-456-7890 123.456.7890 1234567890

subscriber_number()

Specs

subscriber_number :: String.t
subscriber_number(n)

Specs

subscriber_number(n :: Integer.t) :: String.t

Returns a random subscriber number n digits long