Should .exists() check for null values as well?
See original GitHub issueCurrently the .exists() validator only checks for undefined, does it make sense to add an option to also check for null? Something like:
check('id').exists({ checkFalsy: true }) //or check('id').exists({ checkNull: true })
or should we be using a different validator like notEmpty() or not().optional() ?
Thanks so much for your help.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Should one check for null if he does not expect null?
In this case it is OK to have a null value. Method m1() should check it as any other value: there is no...
Read more >Is it necessary to test for NULL if also testing for greater than?
My understanding is that if @Test is NULL , then it has no value, and is not greater than, less than or even...
Read more >Working with SQL NULL values
This article will show functions and operators for handling SQL NULL values.
Read more >Checking If Any Value is NaN in a Pandas DataFrame
Within pandas, a null value is considered missing and is denoted by NaN. This article details how to evalute pandas for missing data...
Read more >NULL semantics - Azure Databricks
In Azure Databricks, IN and NOT IN expressions are allowed inside a WHERE clause of a query. Unlike the EXISTS expression, IN expression...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@sant123
false
or0
would succeed when check with.not().isEmpty()
, as it will only check the string representation of the value has something in it (null
andundefined
are both represented as an empty string).A
checkFalsy
option forexists
would work differently, failing the validation if the value is falsy.This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.