Skip to content
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

Extend Phone interface to support NANP compatible numbers #65

Open
DLzer opened this issue Dec 31, 2024 · 0 comments
Open

Extend Phone interface to support NANP compatible numbers #65

DLzer opened this issue Dec 31, 2024 · 0 comments

Comments

@DLzer
Copy link

DLzer commented Dec 31, 2024

Why?

The current phone number system supports E.164 numbers which is great for mass generation of internationally compatible numbers. However, I've run into validation issues with North American numbers given E.164 allows for North American style phone numbers that aren't able to be validated and break the NANP system.

What is NANP?

NANP Is the North American Numbering Plan. A standardized format for the number system in World Zone 1.

NANP numbers?

  • NANP numbers are ten digits in length
  • NANP numbers are in the format NXX-NXX-XXXX, where N is any digit 2-9 and X is any digit 0-9.
  • The first three digits are called the numbering plan area (NPA) code, often called simply the area code.
  • The second three digits are called the central office code or prefix.
  • The final four digits are called the line number.

How?

For me and my teams use cases I've put together a small package that allows the generation and validation of NANP format numbers. It's by no means a be-all-end-all and could be further optimized but it's a great start for a discussion to help extend the existing Faker functionality.

The library can be found here called GoNanp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant