Skip to content
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

Mustache helper has no rendered output, if the output is 0. #1109

Closed
asavoy opened this issue Jun 24, 2014 · 4 comments · Fixed by #2016
Closed

Mustache helper has no rendered output, if the output is 0. #1109

asavoy opened this issue Jun 24, 2014 · 4 comments · Fixed by #2016
Assignees
Labels
Milestone

Comments

@asavoy
Copy link
Contributor

asavoy commented Jun 24, 2014

When writing an inline Mustache helper, if the result from the helper is the number zero, then it won't be rendered.

See example: http://jsfiddle.net/qYdwR/1601/

Context: I'm trying to write a helper for conveniently handling numerical values, rounding them to the nearest whole number, and displaying null values in a consistent way.

@asavoy
Copy link
Contributor Author

asavoy commented Jun 24, 2014

If the result is converted to a String (i.e. the result is "0" - zero in a string), then zero will be rendered.

alexisabril pushed a commit that referenced this issue Oct 2, 2015
@alexisabril alexisabril self-assigned this Oct 2, 2015
@alexisabril alexisabril added this to the 2.3.0 milestone Oct 2, 2015
@alexisabril alexisabril added the bug label Oct 2, 2015
@alexisabril
Copy link
Contributor

This also exists in stache due to: https://github.com/bitovi/canjs/blob/minor/view/stache/expression.js#L329

Adding a test and leaving open while I verify if we should be checking for all falsey values, or just undefined.

@DesignByOnyx
Copy link
Contributor

Hey @alexisabril - I have fixed Stache already (haven't pushed yet) and know where to fix this one. Do you want me to go ahead and do it?

@alexisabril
Copy link
Contributor

@DesignByOnyx Yeah, merge in that test I wrote(or copy it) and we should be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants