diff options
author | Blake Embrey <hello@blakeembrey.com> | 2013-12-28 22:31:45 -0500 |
---|---|---|
committer | Blake Embrey <hello@blakeembrey.com> | 2013-12-28 22:31:45 -0500 |
commit | 150e55aa009e3af02f585e921213bfcff9999427 (patch) | |
tree | 6036e58ea45eff28d88ae508c241d9d814fc052f /lib/handlebars/compiler/javascript-compiler.js | |
parent | 6c2137a420aa1007dfed85db88021e09ddc66a04 (diff) | |
download | handlebars.js-150e55aa009e3af02f585e921213bfcff9999427.zip handlebars.js-150e55aa009e3af02f585e921213bfcff9999427.tar.gz handlebars.js-150e55aa009e3af02f585e921213bfcff9999427.tar.bz2 |
Pull options out from param setup to allow easier extension.
Diffstat (limited to 'lib/handlebars/compiler/javascript-compiler.js')
-rw-r--r-- | lib/handlebars/compiler/javascript-compiler.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js index 159a38b..607b030 100644 --- a/lib/handlebars/compiler/javascript-compiler.js +++ b/lib/handlebars/compiler/javascript-compiler.js @@ -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()); @@ -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(', '); } }; |