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

Should empty strings be falsy for Mustache? #94

Closed
epickerel opened this issue May 12, 2011 · 1 comment
Closed

Should empty strings be falsy for Mustache? #94

epickerel opened this issue May 12, 2011 · 1 comment

Comments

@epickerel
Copy link

I have data objects that follow standard formats... ie, common property names at all levels:

{
  title: 'level one',
  description: 'level one description',
  children: [
    {
      title: 'level two',
      desc: 'level two description'
    }
  ]
}

The problem I'm running into is that if I have an empty string on any of the lower level objects' property, the outermost context's value is fetched. I understand the reasons for walking up the context tree (although I can't find it explained in the documentation!). However, I think an empty string is an explicit statement that "this is empty". Making empty strings truthy would also make template rendering more consistent across platforms.

@workryan
Copy link

I'm having the same problem as you. I do not believe empty strings should be evaluated to false.

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

No branches or pull requests

3 participants