This commit is contained in:
Alan Johnson
2011-01-22 10:30:44 -05:00
2 changed files with 26 additions and 1 deletions
+2 -1
View File
@@ -86,7 +86,8 @@ Handlebars.registerHelper('each', function(context, fn, inverse) {
});
Handlebars.registerHelper('if', function(context, fn, inverse) {
if(!context || context === []) {
var condition = typeof context === "function" ? context.call(this) : context;
if(!condition || condition == []) {
return inverse(this);
} else {
return fn(this);