summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2013-04-06 23:17:39 -0500
committerkpdecker <kpdecker@gmail.com>2013-04-06 23:17:39 -0500
commit12d68caa58b21c847c00818a811782a85ecd5266 (patch)
treec39c4429cb0c270b08cc3e0c56f7f8c8e519e00d
parentff32b4e2adbac536c69cb1c87071b8f98c09e50a (diff)
downloadhandlebars.js-12d68caa58b21c847c00818a811782a85ecd5266.zip
handlebars.js-12d68caa58b21c847c00818a811782a85ecd5266.tar.gz
handlebars.js-12d68caa58b21c847c00818a811782a85ecd5266.tar.bz2
Allow compilation of empty string
Fixes #461
-rw-r--r--dist/handlebars.js4
-rw-r--r--lib/handlebars/compiler/compiler.js4
2 files changed, 4 insertions, 4 deletions
diff --git a/dist/handlebars.js b/dist/handlebars.js
index d7f140e..cce5473 100644
--- a/dist/handlebars.js
+++ b/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);
}
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index b028076..b31d92b 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/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);
}