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

Treat an empty string as falsey in inverted sections. #202

Closed
wants to merge 1 commit into from

Conversation

bgreenlee
Copy link

Treat an empty string (or for that matter, any value that evaluates to false) as falsey in inverted sections.

Per the spec (mustache/spec#28), a value is falsey if the host language treats it as falsey. JavaScript treats an empty string as falsey.

Fixes issue #186 (#186)

…o false) as falsey in inverted sections.

Fixes issue janl#186 (janl#186)
@xeoncross
Copy link

Thanks for fixing this bug! Alright @janl, no reason not to pull right? ;)

@mjackson
Copy link
Contributor

Based on this ticket it seems like the jury is still out on whether or not mustache should defer to the host language or maintain its own rigid spec. For now, just for the sake of not breaking with backwards compatibility, I'd like to keep it the way it is (i.e. falsey values are null, undefined, false, and empty arrays). However, I can definitely see the other side of the argument and could be persuaded to go that route as well.

@mjackson
Copy link
Contributor

Let's keep discussion for this issue on #186.

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.

3 participants