Some really dislike switch. It's ok to like and use switch for its intended purpose, as long as you understand its idiosyncrasies.
Thanks for sharing this!
A place to talk about whatever you want
This is a forum category containing topical discussion. You can start new discussions by mentioning this category.
Some really dislike switch. It's ok to like and use switch for its intended purpose, as long as you understand its idiosyncrasies.
Thanks for sharing this!
@julian so adding a && true
at the end of your condition, should work, right?
case object && object.foo && true: {
@nextgraph@fosstodon.org in my case, I just casted it as bool: !!object.foo
. You could also object.hasOwnProperty('foo')
, although that would be true if object.foo = null
too :joy: