I'd like to have my jsRender templates optionally include an "options" property to provide optional fall-backs if a property is not included; specifically rendering one element if the "options" property is included, or another if it is not. Everything works fine if the model passed in contains the property in question, but even {{if typeof ~options.someOption !== 'undefined'}}
gives me Error: Cannot read property 'someOption' of undefined.
Has anyone dealt with this? If so, how do you handle properties of the model passed in that do no exist?
EDIT: This question is really about how to handle missing properties of a model. Given a model with properties A and B, if property B is missing from the model but it is referenced in the template, how can I prevent error messages and handle it's absence elegantly?