Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow compilation of empty string

Fixes #461
  • Loading branch information...
commit 12d68caa58b21c847c00818a811782a85ecd5266 1 parent ff32b4e
@kpdecker kpdecker authored
Showing with 4 additions and 4 deletions.
  1. +2 −2 dist/handlebars.js
  2. +2 −2 lib/handlebars/compiler/compiler.js
View
4 dist/handlebars.js
@@ -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);
}
@@ -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);
}
View
4 lib/handlebars/compiler/compiler.js
@@ -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);
}
@@ -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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.