Faker.Phone API
- Dominant language
- Elixir
- Stars
- 1.2k
- Forks
- 261
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 13
Description
Hey folks,
I thinking about API for phones, here is my thoughts:
- `number/0` as general entry for mobile/landline numbers;
- `cell_number/0` & `mobile_number/0`;
- `landline_number/0`;
- `area_code/0`
- `exchange_code/0`
- `subscriber_number/0`
- `extension/0`
In some cases arity can be 1 cause of rules length of `subscriber_number` based on `area_code` etc
Reasons behind separation is sometimes number split in **db** or **UI**.
I prefer to use `Faker.format/1` there it is possible, because ideas of faker is to provide wide range of real world data (see Russian example below), so phone numbers is not just sequence of number and rules, but also _style_ of formatting. Here is an example of code https://github.com/igas/faker/blob/0eb4aa3334e97e8a9ce41207934d1d631c92cc51/lib/faker/phone/en_gb.ex#L48-L55
And here is example from St. Petersburg, Russia of the same number how it can be written:
- 8 812 123 45 67
- 8 (812) 123 45 67
- 8 812 1234567
- 8 (812) 1234567
- 8 (812) 123-45-67
- 88121234567
- 8812 1234567
- 8-812-123-45-67
- for every example on top first 8 can be replaced by +7
- 1234567
- 123 45 67
- 123-45-67
- etc
I'll be glad to discuss this before 0.7 release and decide API. Any thoughts, suggestions? Pros/cons?
/cc @vforvova @johnhamelink @devshane @efexen @saulecabrera @awanninger
Contributor guide
Assessment
This issue has not been assessed yet.