diff --git a/mustache.js b/mustache.js index b325f8b..8095193 100644 --- a/mustache.js +++ b/mustache.js @@ -443,7 +443,7 @@ var Mustache; } } - return squashedTokens; + return squashedTokens; } function escapeTags(tags) { @@ -464,6 +464,7 @@ var Mustache; * course, the default is to use mustaches (i.e. Mustache.tags). */ exports.parse = function (template, tags) { + template = template || ''; tags = tags || exports.tags; var tagRes = escapeTags(tags); diff --git a/test/parse_test.js b/test/parse_test.js index 6aa0609..b75f87c 100644 --- a/test/parse_test.js +++ b/test/parse_test.js @@ -5,6 +5,7 @@ var Mustache = require('./../mustache'); // A map of templates to their expected token output. Tokens are in the format: // [type, value, startIndex, endIndex]. var expectations = { + '' : [], '{{hi}}' : [ [ 'name', 'hi', 0, 6 ] ], '{{hi.world}}' : [ [ 'name', 'hi.world', 0, 12 ] ], '{{hi . world}}' : [ [ 'name', 'hi . world', 0, 14 ] ],