What is the best way to check for an undefined property in an ejs template?
(I\'m using the node.js package by TJ Holowaychuk)
Example:
var t
Another way to test for a property is to reference it indirectly via the locals object. Using your example:
locals
var tpl = '<% if(locals.foo){ %>foo defined<% }else{ %>foo undefined<% } %>'; console.log(ejs.render(tpl, { locals: { bar: "baz"} }));