-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
isNull is misleading #574
Comments
I am facing the same error. It is not working if the argument is other than string. |
String coercion was removed from the library and it now validates and sanitizes strings only. Passing any other type of input is an error; it's up to the user to make sure the input is a string. As to why it no longer coerces input, have a look at #486 or a57f3c8; there are too many edge cases that are outside the scope of this library. I agree that the |
- Remove isDate() - Renamed isNull() to isEmpty() (validatorjs/validator.js#574)
- Remove isDate() - Renamed isNull() to isEmpty() (validatorjs/validator.js#574)
Have you guys removed the functionality for e.g. Thanks. |
I still think isNull is now missing. How to validate isNull. I want to check (using express-validator) your |
I was updating a codebase that was using an older version of this library, and started getting these errors on code that was using
isNull
:This library (validator.js) validates strings only in...
I then looked at the implementation which simply asserts if the input is a string and then checks the length.
Ideally I think this method should be renamed entirely (to something like
isLengthZero
) or change the implementation to actually check for null.I also found this old issue which states the input is coerced before it gets there, but that doesn't seem to be the case. With that in mind, would it make sense for now to submit a PR to actually call toString before?
The text was updated successfully, but these errors were encountered: