{"id":6907,"date":"2014-05-11T17:43:17","date_gmt":"2014-05-11T17:43:17","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/11\/how-check-variable-for-empty-collection-of-common-programming-errors\/"},"modified":"2014-05-11T17:43:17","modified_gmt":"2014-05-11T17:43:17","slug":"how-check-variable-for-empty-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/11\/how-check-variable-for-empty-collection-of-common-programming-errors\/","title":{"rendered":"How check variable for empty-Collection of common programming errors"},"content":{"rendered":"<p>Are you using an out-of-date version of JsRender? The syntax is <code>{{:name}}<\/code>, and it automatically renders an empty string is name is undefined or null. Unit test here: https:\/\/github.com\/BorisMoore\/jsrender\/blob\/master\/test\/unit-tests\/tests-jsrender-no-jquery.js#L108<\/p>\n<p>With the latest version you can even write <code>{{:a.b.c.name noerror=true}}<\/code> and it will render the empty string even if any of <code>name<\/code>, or <code>a.b.c<\/code> or <code>a.b<\/code> or <code>a<\/code> are undefined or null.<\/p>\n<p>You don&#8217;t need to wrap in an <code>{{if ...}}...{{\/if}}<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you using an out-of-date version of JsRender? The syntax is {{:name}}, and it automatically renders an empty string is name is undefined or null. Unit test here: https:\/\/github.com\/BorisMoore\/jsrender\/blob\/master\/test\/unit-tests\/tests-jsrender-no-jquery.js#L108 With the latest version you can even write {{:a.b.c.name noerror=true}} and it will render the empty string even if any of name, or a.b.c or a.b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6907","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6907"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6907\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}