Skip to content

handle vacuous truth cases #238

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

Closed
wants to merge 1 commit into from

Conversation

liorcode
Copy link
Contributor

@liorcode liorcode commented Sep 25, 2016

In certain validators (such as max length, number) when the value is undefined (or null) the validator should return success.

Currently when the value is undefined and the used validator is "number" or "max length", it causes an exception (TypeError: Cannot read property 'constructor' of undefined)

I updated the min/max length and regex validators, and added tests.

(I also believe this should be true for an empty value, but this is a breaking change so I didn't do it for now)

@coveralls
Copy link

coveralls commented Sep 25, 2016

Coverage Status

Coverage increased (+0.02%) to 93.636% when pulling f372573 on liorch88:handle-vacuous-truth into 531cb12 on huei90:master.

In regex validators (such as number) when the value is undefined (or null) the validator should return success, to comply with the html5 number input.

Since this is a breaking change, it will be enabled only using an opt-in flag called "allowEmptyValues".

I added tests and updated api.
@liorcode liorcode force-pushed the handle-vacuous-truth branch from f372573 to 4c01a62 Compare September 25, 2016 15:05
@liorcode liorcode closed this Sep 25, 2016
@liorcode liorcode deleted the handle-vacuous-truth branch September 25, 2016 15:12
@liorcode liorcode restored the handle-vacuous-truth branch September 25, 2016 15:12
@liorcode liorcode deleted the handle-vacuous-truth branch September 26, 2016 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants