From c95b3d6fc5d250bfb8983969688d420774ce7480 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Sat, 16 Feb 2013 16:18:48 -0600 Subject: [PATCH] Create new options object for unless nesting Fixes #343 --- dist/handlebars.js | 6 +----- dist/handlebars.runtime.js | 6 +----- lib/handlebars/base.js | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/dist/handlebars.js b/dist/handlebars.js index 3cfb57d4c..39afa6419 100644 --- a/dist/handlebars.js +++ b/dist/handlebars.js @@ -152,11 +152,7 @@ Handlebars.registerHelper('if', function(context, options) { }); Handlebars.registerHelper('unless', function(context, options) { - var fn = options.fn, inverse = options.inverse; - options.fn = inverse; - options.inverse = fn; - - return Handlebars.helpers['if'].call(this, context, options); + return Handlebars.helpers['if'].call(this, context, {fn: options.inverse, inverse: options.fn}); }); Handlebars.registerHelper('with', function(context, options) { diff --git a/dist/handlebars.runtime.js b/dist/handlebars.runtime.js index c604a21e1..a55b30fd4 100644 --- a/dist/handlebars.runtime.js +++ b/dist/handlebars.runtime.js @@ -152,11 +152,7 @@ Handlebars.registerHelper('if', function(context, options) { }); Handlebars.registerHelper('unless', function(context, options) { - var fn = options.fn, inverse = options.inverse; - options.fn = inverse; - options.inverse = fn; - - return Handlebars.helpers['if'].call(this, context, options); + return Handlebars.helpers['if'].call(this, context, {fn: options.inverse, inverse: options.fn}); }); Handlebars.registerHelper('with', function(context, options) { diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index a5fbeed48..dcbd95889 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -129,11 +129,7 @@ Handlebars.registerHelper('if', function(context, options) { }); Handlebars.registerHelper('unless', function(context, options) { - var fn = options.fn, inverse = options.inverse; - options.fn = inverse; - options.inverse = fn; - - return Handlebars.helpers['if'].call(this, context, options); + return Handlebars.helpers['if'].call(this, context, {fn: options.inverse, inverse: options.fn}); }); Handlebars.registerHelper('with', function(context, options) {