-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the ability to fake Phone numbers that follow the North American Numbering Plan #2550
Comments
hi @calvinballing thank you for the details. Are you still able to reproduce this scenario after adding the following configuration? faker/doc/default/phone_number.md Lines 46 to 47 in aa31845
There is a reproduction step template available. |
Ah, great, looks like you already have what I was looking for. Thanks! |
that's awesome to hear, @calvinballing I'm curious to know -- if you're interested in sharing: what did you search for? I'm wondering if we could improve the docs to make this feature easier to find. |
@stefannibrasil I looked at: https://github.com/faker-ruby/faker/blob/master/doc/default/phone_number.md While I had seen that there was an |
@calvinballing that comment is indeed misleading. Are you up to submit a PR clarifying this feature? |
Hi - I'm just wondering how to use this. I'm trying to seed a database with only US style numbers. What steps do I need to take? Is there a library I need to include? |
For US numbers you need to set: |
Is your feature request related to a problem? Please describe it.
When using Faker with a validator that checks whether numbers follow the North American Numbering Plan (NANP), Faker can provide invalid inputs, as Faker can supply a 1 or 0 for the first and fourth digits which are invalid in the NANP.
For information about the North American Numbering Plan, see:
https://en.wikipedia.org/wiki/North_American_Numbering_Plan#Modern_plan
Describe alternatives you've considered
The current workaround is to hard-code a phone number, or compose a valid number using https://github.com/faker-ruby/faker/blob/master/doc/default/number.md
Two options might be:
Add a North-America specific phone number generator that follows the NANP
Add a North-America specific method to the existing phone number generator that follows the NANP
The text was updated successfully, but these errors were encountered: