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

Comments

Projects
None yet
3 participants
@asavoy
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

This comment has been minimized.

Show comment
Hide comment
@asavoy

asavoy Jun 24, 2014

Contributor

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

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@alexisabril

alexisabril Oct 2, 2015

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.

Contributor

alexisabril commented Oct 2, 2015

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

This comment has been minimized.

Show comment
Hide comment
@DesignByOnyx

DesignByOnyx Oct 13, 2015

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?

Contributor

DesignByOnyx commented Oct 13, 2015

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

This comment has been minimized.

Show comment
Hide comment
@alexisabril

alexisabril Oct 14, 2015

Contributor

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

Contributor

alexisabril commented Oct 14, 2015

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

DesignByOnyx added a commit that referenced this issue Oct 22, 2015

@daffl daffl closed this in #2016 Oct 22, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment