{"action":"created","issue":{"url":"https://api.github.com/repos/mde/ejs/issues/35","labels_url":"https://api.github.com/repos/mde/ejs/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/mde/ejs/issues/35/comments","events_url":"https://api.github.com/repos/mde/ejs/issues/35/events","html_url":"https://github.com/mde/ejs/issues/35","id":54962000,"number":35,"title":"Inconsistent behavior on undefined object property reference","user":{"login":"wjordan","id":56541,"avatar_url":"https://avatars.githubusercontent.com/u/56541?v=3","gravatar_id":"","url":"https://api.github.com/users/wjordan","html_url":"https://github.com/wjordan","followers_url":"https://api.github.com/users/wjordan/followers","following_url":"https://api.github.com/users/wjordan/following{/other_user}","gists_url":"https://api.github.com/users/wjordan/gists{/gist_id}","starred_url":"https://api.github.com/users/wjordan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjordan/subscriptions","organizations_url":"https://api.github.com/users/wjordan/orgs","repos_url":"https://api.github.com/users/wjordan/repos","events_url":"https://api.github.com/users/wjordan/events{/privacy}","received_events_url":"https://api.github.com/users/wjordan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-21T00:40:06Z","updated_at":"2015-01-21T01:44:30Z","closed_at":null,"body":"Minimal test:\r\n```js\r\nrequire('ejs').render('<%- data.test %>', {data:{}})\r\n```\r\nIn ejs <=1.0.0, this returns `''` (empty string).\r\nIn ejs 2.x, this returns `'undefined'`.\r\n\r\nThis breaks some existing templates, so unless there's an intentional reason to make this breaking change (and it's clearly documented), I would like to see consistency with the <=1.0.0 behavior."},"comment":{"url":"https://api.github.com/repos/mde/ejs/issues/comments/70770495","html_url":"https://github.com/mde/ejs/issues/35#issuecomment-70770495","issue_url":"https://api.github.com/repos/mde/ejs/issues/35","id":70770495,"user":{"login":"TimothyGu","id":1538624,"avatar_url":"https://avatars.githubusercontent.com/u/1538624?v=3","gravatar_id":"","url":"https://api.github.com/users/TimothyGu","html_url":"https://github.com/TimothyGu","followers_url":"https://api.github.com/users/TimothyGu/followers","following_url":"https://api.github.com/users/TimothyGu/following{/other_user}","gists_url":"https://api.github.com/users/TimothyGu/gists{/gist_id}","starred_url":"https://api.github.com/users/TimothyGu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimothyGu/subscriptions","organizations_url":"https://api.github.com/users/TimothyGu/orgs","repos_url":"https://api.github.com/users/TimothyGu/repos","events_url":"https://api.github.com/users/TimothyGu/events{/privacy}","received_events_url":"https://api.github.com/users/TimothyGu/received_events","type":"User","site_admin":false},"created_at":"2015-01-21T01:44:30Z","updated_at":"2015-01-21T01:44:30Z","body":"Technically this is a breaking change. @mde what do you think?\r\n\r\nTo fix this, I would need to make EJS output templates like one of these:\r\n\r\n1. EJS 1 style:\r\n\r\n   ```js\r\nvar buf = []\r\n[...]\r\n;buf.push(data.test)\r\n[...]\r\n;return buf.join('')\r\n```\r\n\r\n2. Ternary operator:\r\n\r\n   ```js\r\nvar __output = ''\r\n[...]\r\n;__output += (data.test) == null ? '' : data.test\r\n[...]\r\n;return __output\r\n```\r\n\r\nI'll do some benchmark on these."}}