Allow null in inclusion to match devel

This commit is contained in:
David Greenspan
2014-06-09 12:32:32 -07:00
parent 1365e63ff8
commit adcf6c853c

View File

@@ -1,7 +1,10 @@
Spacebars.include2 = function (templateOrFunction, dataFunc, contentFunc, elseFunc) {
var template = Spacebars.call(templateOrFunction);
if (template === null)
return null;
if (! (template instanceof Blaze.Component))
throw new Error("Expected template, found: " + template);
throw new Error("Expected template or null, found: " + template);
return new template.constructor(dataFunc, contentFunc, elseFunc);
};