Just a coder and a dad. I love my family and I love to code!!!! started coding at 11, so I have 25 years under my belt. Still love learning about it every day. Black lives matter!
Just a coder and a dad. I love my family and I love to code!!!! started coding at 11, so I have 25 years under my belt. Still love learning about it every day. Black lives matter!
You have a good point, but are you expecting your system to act like that? It's very rare you need to actually be checking for that, but if you do suspect it then definitely go for the finite checking.
But then again, I love using the "joi" package for my type checking.
Normally no, but in this case yes. It's a bare-bones project and the code is constructing a DB query from a set of known inputs, so null and undefined get treated as null, strings get quotes around them, and everything else is passed through.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
@dechamp something like:
?
yup! that is the good stuff right there!
And based off your example I would do this...
check for no value first, save the code from type checking if it's not set.
What if val is
0
orfalse
? 😉You have a good point, but are you expecting your system to act like that? It's very rare you need to actually be checking for that, but if you do suspect it then definitely go for the finite checking.
But then again, I love using the "joi" package for my type checking.
Normally no, but in this case yes. It's a bare-bones project and the code is constructing a DB query from a set of known inputs, so
null
andundefined
get treated asnull
, strings get quotes around them, and everything else is passed through.