Skip to content

Commit

Permalink
Allow compilation of empty string
Browse files Browse the repository at this point in the history
Fixes #461
  • Loading branch information
kpdecker committed Apr 7, 2013
1 parent ff32b4e commit 12d68ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dist/handlebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -2079,7 +2079,7 @@ JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
};

Handlebars.precompile = function(input, options) {
if (!input || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
if (input == null || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input);
}

Expand All @@ -2093,7 +2093,7 @@ Handlebars.precompile = function(input, options) {
};

Handlebars.compile = function(input, options) {
if (!input || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
if (input == null || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/handlebars/compiler/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
};

Handlebars.precompile = function(input, options) {
if (!input || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
if (input == null || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input);
}

Expand All @@ -1252,7 +1252,7 @@ Handlebars.precompile = function(input, options) {
};

Handlebars.compile = function(input, options) {
if (!input || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
if (input == null || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input);
}

Expand Down

0 comments on commit 12d68ca

Please sign in to comment.