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

unexpected behavior isNull and notNull #62

Closed
mren opened this issue Feb 24, 2012 · 1 comment
Closed

unexpected behavior isNull and notNull #62

mren opened this issue Feb 24, 2012 · 1 comment

Comments

@mren
Copy link
Contributor

mren commented Feb 24, 2012

isNull and notNull are implemented in this way

notNull: function(str) {
    return str !== '';
},
isNull: function(str) {
    return str === '';
},

which checks if the string is empty and not if the object is null.
Wouldn't be

isNull: function(str) {
    return str === null;
},
notNull: function(str) {
    return !validators.isNull(str);
}

be more consistent with the validation name?

@chriso
Copy link
Collaborator

chriso commented Feb 24, 2012

Validator input is coerced before ever getting to that stage so that all of the weird potential inputs are handled correctly - undefined, null, NaN, etc.

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

No branches or pull requests

2 participants