Skip to content

Commit

Permalink
Pull options out from param setup to allow easier extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Dec 29, 2013
1 parent 6c2137a commit 150e55a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/handlebars/compiler/javascript-compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -798,9 +798,7 @@ JavaScriptCompiler.prototype = {
};
},

// the params and contexts arguments are passed in arrays
// to fill in
setupParams: function(paramSize, params, useRegister) {
setupOptions: function(paramSize, params) {
var options = [], contexts = [], types = [], param, inverse, program;

options.push("hash:" + this.popStack());
Expand Down Expand Up @@ -846,14 +844,21 @@ JavaScriptCompiler.prototype = {
options.push("data:data");
}

options = "{" + options.join(",") + "}";
return options;
},

// the params and contexts arguments are passed in arrays
// to fill in
setupParams: function(paramSize, params, useRegister) {
var options = '{' + this.setupOptions(paramSize, params).join(',') + '}';

if (useRegister) {
this.register('options', options);
params.push('options');
} else {
params.push(options);
}
return params.join(", ");
return params.join(', ');
}
};

Expand Down

0 comments on commit 150e55a

Please sign in to comment.