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

Returning 0 from a helper displays nothing #1985

Closed
dylanrtt opened this issue Oct 12, 2015 · 3 comments · Fixed by #2016
Closed

Returning 0 from a helper displays nothing #1985

dylanrtt opened this issue Oct 12, 2015 · 3 comments · Fixed by #2016
Labels
Milestone

Comments

@dylanrtt
Copy link
Contributor

Not sure if this has been reported already, but I think returning the number 0 from a helper should display the 0. It currently displays nothing. I'm guessing there is a truthy check on the helper's output.

// when bar is 0
{{ bar }} // prints "0"
{{ myHelper bar }} // blank (myHelper simply returns the value())

http://jsbin.com/helasubejo/edit?html,js,output

@DesignByOnyx
Copy link
Contributor

There is a truthy check here: https://github.com/bitovi/canjs/blob/master/view/stache/mustache_core.js#L535

We need to make sure this wouldn't be a breaking change as some authors might return 0 with the intent of give me an empty string.

@justinbmeyer
Copy link
Contributor

This is a bug. Returning 0 to get an empty string wouldn't make sense and its not documented that way so it's ok to change prior to 3.0.

@asavoy
Copy link
Contributor

asavoy commented Oct 13, 2015

This would be the stache equivalent to this mustache issue: #1109

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.

5 participants