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

feat(develop): added phonenumber type validator to IsPhoneNumber.ts #2557

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

Sylar-3
Copy link

@Sylar-3 Sylar-3 commented Nov 21, 2024

Description

Added new feature to check the phonenumber type using .getType() method from libphonenumber-js

Checklist

  • the pull request title describes what this PR does (not a vague title like Update index.md)
  • the pull request targets the default branch of the repository (develop)
  • the code follows the established code style of the repository
  • npm run prettier:check passes
  • npm run lint:check passes
  • tests are added for the changes I made (if any source code was modified)
  • documentation added or updated
  • I have run the project locally and verified that there are no errors.

@Sylar-3
Copy link
Author

Sylar-3 commented Nov 21, 2024

Please check this change and let me know if anything needs to be modified.
Since it is an optional parameter to the function it shouldn't break any existing applications.
The new feature relies on the provided options in the [https://www.npmjs.com/package/libphonenumber-js].
Hopefully this will make validating phone number types more clear since it will specify the phone number type rather than using a default value in the lib.

Copy link

@M7Khouli M7Khouli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helpful changes

Copy link

@kareemalkoul kareemalkoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great changing

@shevchenkonik
Copy link

Hi @Sylar-3, what is the benefit of defining types inside the library instead of using original types from libphonenumber-js?

@Sylar-3
Copy link
Author

Sylar-3 commented Nov 25, 2024

Hi @Sylar-3, what is the benefit of defining types inside the library instead of using original types from libphonenumber-js?

Thanks @shevchenkonik for your insight, actually there is no value in this as you just said, but this will make it easier for developers to check these types in the validator itself rather than going to the library and search for them.

if there is any other question or issue please let me know since this pull request might help a lot in validating some APIs I'm using.

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

Successfully merging this pull request may close these issues.

4 participants