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

Expose the reason for a number being invalid #65

Open
Tux opened this issue Feb 20, 2017 · 2 comments
Open

Expose the reason for a number being invalid #65

Tux opened this issue Feb 20, 2017 · 2 comments
Labels

Comments

@Tux
Copy link

Tux commented Feb 20, 2017

It would be awesome is there would be a method or a global that enables me to see the reason for a number not being valid (invalid country code, too long, too short, invalid area code, invalid characters, ...)

@DrHyde
Copy link
Owner

DrHyde commented Feb 22, 2017

Yes, it would!

I don't particularly like globals or extra methods for seeing why something failed, so what do you think about using objects that:

  • numify as 0;
  • stringify as "0" (just in case someone is mis-using the return value);
  • boolify as false

and have a reason() method that would return one of a documented set of constants?

Or am I over-thinking this and should just suck up a bit of ugliness?

@DrHyde DrHyde changed the title [feature request] the reason for a number being invalid Expose the reason for a number being invalid Feb 22, 2017
@Tux
Copy link
Author

Tux commented Feb 22, 2017

FINE WITH ME!
(capitalized to show enthusiasm)

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

No branches or pull requests

2 participants