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

unable to use cell_phone, no API seems to expose it. #2933

Open
dumbasPL opened this issue Jun 1, 2024 · 1 comment
Open

unable to use cell_phone, no API seems to expose it. #2933

dumbasPL opened this issue Jun 1, 2024 · 1 comment
Labels
m: phone Something is referring to the phone module question Further information is requested

Comments

@dumbasPL
Copy link

dumbasPL commented Jun 1, 2024

I can't find a way to generate a cell_phone number for a specific locale. Most (if not all) of the locales seem to have formats for cell_phone but no API seems to expose it. Are they even supported, if not, why are there a bunch of format files for them? I know phone exists, but I'm interested only in cellphone numbers.

Is this just a case of missing the typescript definitions or what's the issue?

@matthewmayer
Copy link
Contributor

You are correct, they are old, unsupported and not exposed by the current APIs. While you could try to access the raw definitions this is not recommended as these definitions might be removed.

If you're interested in adding the ability to generate mobile numbers only (in countries where this is possible - e.g. not the US, where mobile and landline numbers look the same), please see discussion at
#2883 where you could add your use-case.

In the meantime, you can fairly easily roll your own for a specific locale using other helper functions e.g. for en-GB numbers which start 07 you could use
faker.helpers.fromRegExp("07[0-9]{9}")

@ST-DDT ST-DDT added question Further information is requested m: phone Something is referring to the phone module labels Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
m: phone Something is referring to the phone module question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants