Documentation for IsTruthy/IsFalsy is wrong.
strout opened this issue · 6 comments
Describe the bug
IsTruthy
's doc comment says it implements JS ==
and IsFalsy
's says it implements JS's !=
.
Expected behavior:
I'd expect something mentioning JS coercion to boolean for IsTruthy
and maybe the !
operator for IsFalsy
. Consider a link to MDN articles on Truthy/Falsy, and maybe call out any surprising edge cases (.NET types that aren't coerced, if they're intentionally omitted).
It would also be nice to have an actual implementation of JS's ==
and !=
. The documentation got my hopes up for a second :)
Hello @strout
Can you please elaborate more on the issue (e.g. example, etc.) because I do not think I get it right? If this is bug what is wrong with the behavior?
No problem. The behavior of IsTruthy/IsFalsy is fine, and exactly what I expect. It's just the doc comments don't match the behavior.
The doc comment for IsTruthy is:
Implementation of JS's
==
But that's not what IsTruthy
does. ==
takes two arguments and checks if they're equal, but IsTruthy
takes one argument and checks if it's truthy.
Maybe a better wording would be something like
Implementation of JS's Boolean type conversion
This is a lot of conversation for what could’ve been a PR on the readme 😄
Indeed! I haven't had the time yet but plan on making one.