diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js index cc26eb240..b21df1d8a 100644 --- a/lib/handlebars/compiler/javascript-compiler.js +++ b/lib/handlebars/compiler/javascript-compiler.js @@ -543,7 +543,7 @@ JavaScriptCompiler.prototype = { if (this.hash) { this.hashes.push(this.hash); } - this.hash = {values: [], types: [], contexts: [], ids: []}; + this.hash = {values: {}, types: [], contexts: [], ids: []}; }, popHash: function() { let hash = this.hash; diff --git a/spec/regressions.js b/spec/regressions.js index 58db65bcd..a8879067e 100644 --- a/spec/regressions.js +++ b/spec/regressions.js @@ -323,4 +323,15 @@ describe('Regressions', function() { }, 'useData': true}); } }); + + it('should allow hash with protected array names', function() { + var obj = {array: [1], name: 'John'}; + var helpers = { + helpa: function(options) { + return options.hash.length; + } + }; + + shouldCompileTo('{{helpa length="foo"}}', [obj, helpers], 'foo'); + }); });