Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Create new options object for unless nesting
Fixes #343
  • Loading branch information
kpdecker committed Feb 16, 2013
1 parent d6f146f commit c95b3d6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
6 changes: 1 addition & 5 deletions dist/handlebars.js
Expand Up @@ -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) {
Expand Down
6 changes: 1 addition & 5 deletions dist/handlebars.runtime.js
Expand Up @@ -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) {
Expand Down
6 changes: 1 addition & 5 deletions lib/handlebars/base.js
Expand Up @@ -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) {
Expand Down

0 comments on commit c95b3d6

Please sign in to comment.