Skip to content

Should empty strings be falsy for Mustache? #94

@epickerel

Description

@epickerel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions