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

randPhoneNumber will generate invalid US phone numbers #368

Open
Akkuma opened this issue Dec 13, 2023 · 1 comment
Open

randPhoneNumber will generate invalid US phone numbers #368

Akkuma opened this issue Dec 13, 2023 · 1 comment

Comments

@Akkuma
Copy link

Akkuma commented Dec 13, 2023

Is this a regression?

No

Description

When randPhoneNumber is used as randPhoneNumber({ countryCode: 'US' }) the numbers generated are at risk of not being actually valid numbers.

Please provide a link to a minimal reproduction of the bug

https://runkit.com/akkuma/65798236cdff300008bc8b3f

Please provide the exception or error you saw

No errors or exceptions

Please provide the environment you discovered this bug in

node v20

Anything else?

Looking through the code it looks like the simplest solution would be to extend the formats on https://github.com/ngneat/falso/blob/main/packages/falso/src/lib/phone-number.json#L976 to be representative of a list like https://github.com/AfterShip/phone/blob/master/src/data/country_phone_data.ts#L2-L31. Alternatively, could use data like that to dynamically generate the mask formats as to not need to keep updating them.

Do you want to create a pull request?

Yes

@NetanelBasal
Copy link
Member

You're welcome to create a PR

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

No branches or pull requests

2 participants