-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"if" helper considers 0 to be a falsy value #597
Comments
If this gets accepted, can you please add this behaviour to the documentation (i.e. write that 0 is not a falsy value)? I ask this because, as a JavaScript developer, I would kind of expect 0 to be evaluated as falsy... And thus it would be clearer for everybody. Thank you. |
@artiee @gnclmorais See #608 for discussion on this. After checking the new behavior for the upcoming alpha release I am worried that this will break almost all code that is out there already and the expectations of javascript developers as @gnclmorais notes. |
Released in 1.1.0 |
The if-helper seems to consider value 0 (zero) to be falsy because the simple "!conditional" -test is used. This creates problems with many apps as 0 should be considered as a real value. The falsy values should be 'undefined', null, false, '', [], and {}.
Also the Utils.isEmpty seems to recheck that value isn't 0. This seems unnecessary.
The text was updated successfully, but these errors were encountered: