diff --git a/mustache.js b/mustache.js index 8095193..16b7429 100644 --- a/mustache.js +++ b/mustache.js @@ -254,7 +254,8 @@ var Mustache; return self.render(template, context); }; - return value.call(context.view, text, scopedRender) || ""; + var result = value.call(context.view, text, scopedRender); + return result != null ? result : ""; default: if (value) { return callback(this, context); diff --git a/test/_files/check_falsy.js b/test/_files/check_falsy.js new file mode 100644 index 0000000..5a599ca --- /dev/null +++ b/test/_files/check_falsy.js @@ -0,0 +1,7 @@ +({ + number: function(text, render) { + return function(text, render) { + return +render(text); + } + } +}) diff --git a/test/_files/check_falsy.mustache b/test/_files/check_falsy.mustache new file mode 100644 index 0000000..30e2547 --- /dev/null +++ b/test/_files/check_falsy.mustache @@ -0,0 +1 @@ +
{{#number}}0{{/number}}
diff --git a/test/_files/check_falsy.txt b/test/_files/check_falsy.txt new file mode 100644 index 0000000..3bb2f51 --- /dev/null +++ b/test/_files/check_falsy.txt @@ -0,0 +1 @@ +0