Handlebars-Net / Handlebars.Net

A real .NET Handlebars engine
MIT License
1.24k stars 214 forks source link

Documentation for IsTruthy/IsFalsy is wrong. #467

Open strout opened 3 years ago

strout commented 3 years ago

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 commented 3 years ago

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

oformaniuk commented 2 years ago

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?

strout commented 2 years ago

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

rexm commented 2 years ago

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

strout commented 2 years ago

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

StefH commented 8 months ago

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