'truthy' and 'falsy' should be chainable properties.
See original GitHub issueEspecially since the description for ok
actually uses the word truthy.
Issue Analytics
- State:
- Created 10 years ago
- Reactions:37
- Comments:10 (1 by maintainers)
Top Results From Across the Web
How to check for falsy values in properties of a chain of ...
I could get the code to work by using the Conditional (ternary) operator and checking for falsy values as below: let locationDistrict =...
Read more >If Statements, Function Returns, Truthy and Falsy - Wes Bos
You can also chain these "else ifs" as many times as you want. However, if the first one is true, even if the...
Read more >The Semantics of Falsy Values - DEV Community
Just like empty arrays, empty objects are considered to be "truthy" by the language specification. For the sake of this article, I will...
Read more >Truthy and Falsy Values: When All is Not Equal in JavaScript
Anything in JavaScript can be considered truthy or falsy. Learn what these values are and the rules that apply when they're compared.
Read more >Logical AND (&&) - JavaScript - MDN Web Docs
If a value can be converted to true , the value is so-called truthy. If a value can be converted to false ,...
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
Realize this is closed, but giving this a 👍 because I also think that “truthy”/“falsy” is more clear than “ok”.
Consider this fairly common scenario: Some API’s return a result object which may or may not have a property
error
. The presence of said property indicates that there was … an error. So while writing a test where I expect an error, I might do something like this:That is potentially confusing to someone who isn’t familiar with chai. The following is easier to understand.
If you google “javascript ok” vs. “javascript truthy”, I think it shows that
truthy
is a better choice thanok
.Chai is full of redundant syntax, so rejection on that basis seems arbitrary.
above
,gt
,greaterThan
equal
,equals
,eq
include
,contain
I could be persuaded to give up on
falsy
in favor ofnot.truthy
, but I’d ask you to reconsider rejecting the idea in its entirety.