Handlebars.Net icon indicating copy to clipboard operation
Handlebars.Net copied to clipboard

Documentation for IsTruthy/IsFalsy is wrong.

Open strout opened this issue 4 years ago • 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).

strout avatar Sep 08 '21 20:09 strout

It would also be nice to have an actual implementation of JS's == and !=. The documentation got my hopes up for a second :)

strout avatar Sep 08 '21 20:09 strout

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?

oformaniuk avatar Sep 09 '21 00:09 oformaniuk

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

strout avatar Sep 10 '21 15:09 strout

This is a lot of conversation for what could’ve been a PR on the readme 😄

rexm avatar Sep 10 '21 21:09 rexm

Indeed! I haven't had the time yet but plan on making one.

strout avatar Sep 10 '21 22:09 strout

@strout Did you have time yet to create a PR on the documentation?

StefH avatar Jan 05 '24 08:01 StefH