diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js index 4e4f288ae..ed1b83ef9 100644 --- a/lib/handlebars/compiler/javascript-compiler.js +++ b/lib/handlebars/compiler/javascript-compiler.js @@ -503,7 +503,7 @@ JavaScriptCompiler.prototype = { if (this.hash) { this.hashes.push(this.hash); } - this.hash = {values: [], types: [], contexts: [], ids: []}; + this.hash = {values: {}}; }, popHash: function() { let hash = this.hash; diff --git a/spec/regressions.js b/spec/regressions.js index 4a2a55cd6..4dc2ac89c 100644 --- a/spec/regressions.js +++ b/spec/regressions.js @@ -277,4 +277,15 @@ describe('Regressions', function() { shouldCompileTo(string, { listOne: ['a'], listTwo: ['b']}, 'ab', ''); }); + + 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'); + }); });