In JavaScript:
falsy: false, null, undefined, 0, -0, NaN, "" truthy: everything else, including [] and {} (empty array and empty object)
But in Handlebars it seems like this (from Handlebars Docs ) for {{#if foo}} :
falsy: false, undefined, null, "", [] truthy: everything else, including 0, -0, {}
undefined and NaN cannot be specified as a value in the JSON file, so I cannot test it using the Java Mustache renderer, although if I don't define a property at all, it's probably just undefined , and this is taken as a lie.
Above for {{#if foo}} , and to make things more complicated, but what about {{#foo}} in Handlebars and Mustache? Are fake rules and rules the same as {{#if foo}} ? If possible, provide pointers to documents to support your request. We hope that the implementation of Mustache or Handlebars in PHP or Java or in other languages follows exactly the same rules.
I also found that for Mustache it seems that {{#foo}} is called a section, and its rule is:
falsy: whatever falsy in JavaScript, plus [] truthy: everything else
But it seems that the implementation of can.js Mustache / Handlebars treats 0 as fake. ( http://jsfiddle.net/kAt7E/45/ vs http://jsfiddle.net/kAt7E/46/ or http://jsfiddle.net/kAt7E/47/ vs http://jsfiddle.net/kAt7E/ 48 / ). So it is somewhat worrying that there are so many different rules.