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

Fix {{!value}} out when the value is number 0 #274

Closed
wants to merge 1 commit into from

Conversation

keel
Copy link

@keel keel commented May 25, 2018

{{!value}} out '' when the value is number 0 or boolean false, but{{=value}} is right, so I think this should be fixed.

@keel
Copy link
Author

keel commented May 26, 2018

@epoberezkin I think templet engine does not expects the input value is always string, just like jsp, <%=new Integer(0) %> it will out "0" not "" , and {{=does the right output ,it will be '0', {{! should be the same, and also there're similar issues before, like #170 , #178, #183 .
So I think it should be fixed.

The tests failed last time because the travis itself, anyway I send a new PR in v2.0.0.

sgruetter added a commit to sgruetter/doT that referenced this pull request Dec 17, 2018
This change fixes an issue where falsy values (i.e. false, null,
undefined, 0, NaN) lead to an empty string. All of these values except
undefined are now stringified when rendering with {{! }} to have them
rendered. undefined continues to lead to an empty string to avoid
introduce many issues with existing usages.

Fixes olado#274, olado#170, olado#178, olado#183.
@epoberezkin
Copy link
Collaborator

2.0 will support custom encoders, non-strings will be interpolated as is.

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

Successfully merging this pull request may close these issues.

2 participants