javascript icon indicating copy to clipboard operation
javascript copied to clipboard

[FEATURE REQUEST] isValidPhone(type) instead of isValidPhone()

Open silvioprog opened this issue 6 years ago • 5 comments

Hi.

It would be nice to allow to validade a phone number by its type, for example:

const test = isValidPhone(); // Validates both phone and mobile phone number
const test = isValidPhone(false); // Validates only phone number
const test = isValidPhone(true); // Validates only mobile phone number

or maybe providing separated functions, like isValidPhone() and isValidMobilePhone().

cheers

silvioprog avatar Jul 06 '20 18:07 silvioprog

Hello @silvioprog , nice idea! I think that we should keep isValidPhone validating both mobile phone and landline phone and create another 2 utilities:isValidLandlinePhoneand isValidMobilePhone to validate each type separatly. In that way, we don't break our current API: D

What do you think about that?

hyanmandian avatar Jul 06 '20 18:07 hyanmandian

Hello @hyanmandian, isValidLandlinePhone() and isValidMobilePhone() sounds very good, I totally agree with them. 😃

I'm excited with brazillian-utils, this is really an awesome project. Thank you for maintaining it! 😄

silvioprog avatar Jul 07 '20 13:07 silvioprog

Thanks! I don't have time right now to implement these utilities (maybe next week), but you can contribute with our project if you feel comfortable with that.

hyanmandian avatar Jul 07 '20 13:07 hyanmandian

@hyanmandian Great! So, i'm going to fork this repo and try to implement it to send as PR ...

Edit: PR sent at https://github.com/brazilian-utils/brazilian-utils/pull/98.

silvioprog avatar Jul 07 '20 14:07 silvioprog

closed by #98

hyanmandian avatar Jul 09 '20 16:07 hyanmandian