{"action":"created","issue":{"url":"https://api.github.com/repos/babel/minify/issues/819","repository_url":"https://api.github.com/repos/babel/minify","labels_url":"https://api.github.com/repos/babel/minify/issues/819/labels{/name}","comments_url":"https://api.github.com/repos/babel/minify/issues/819/comments","events_url":"https://api.github.com/repos/babel/minify/issues/819/events","html_url":"https://github.com/babel/minify/issues/819","id":312368154,"number":819,"title":"TypeError: Cannot convert undefined or null to object on this simple code","user":{"login":"samuelcarreira","id":4456690,"avatar_url":"https://avatars1.githubusercontent.com/u/4456690?v=4","gravatar_id":"","url":"https://api.github.com/users/samuelcarreira","html_url":"https://github.com/samuelcarreira","followers_url":"https://api.github.com/users/samuelcarreira/followers","following_url":"https://api.github.com/users/samuelcarreira/following{/other_user}","gists_url":"https://api.github.com/users/samuelcarreira/gists{/gist_id}","starred_url":"https://api.github.com/users/samuelcarreira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samuelcarreira/subscriptions","organizations_url":"https://api.github.com/users/samuelcarreira/orgs","repos_url":"https://api.github.com/users/samuelcarreira/repos","events_url":"https://api.github.com/users/samuelcarreira/events{/privacy}","received_events_url":"https://api.github.com/users/samuelcarreira/received_events","type":"User","site_admin":false},"labels":[{"id":669033990,"url":"https://api.github.com/repos/babel/minify/labels/needs%20info","name":"needs info","color":"c9fb02","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-09T02:10:53Z","updated_at":"2018-05-02T08:50:44Z","closed_at":null,"author_association":"NONE","body":"<!---\r\nThanks for filing an issue 😄! Before you submit, please read the following:\r\n\r\nSearch open/closed issues before submitting since someone might have asked the same thing before!\r\n\r\nIf you have a support request or question please submit them to the #minify channel on babeljs slack: https://babeljs.slack.com/messages/minify\r\n\r\nAlso have a look at the Debugging guidelines: https://github.com/babel/minify/blob/master/CONTRIBUTING.md#debugging\r\n\r\nThings required:\r\n\r\nFor a bug:\r\n\r\n1. Minimal code to reproduce the bug\r\n2. Stack Trace if there is an Error thrown during minification\r\n3. Configuration - babel-minify configuration or babelrc\r\n4. Whether you used it with other presets/plugins - like es2015 or env\r\n5. Environment: gulp, rollup, webpack, babel-cli, etc...?\r\n\r\nFor an enhancement:\r\n\r\n1. Description\r\n2. Code Examples with transformations\r\n\r\n-->\r\n\r\n#### Input Code\r\n\r\n```js\r\n/**\r\n * Disable all buttons except the choosen on\r\n * @param {number} tier number 1 to 6 - disable/select this\r\n */\r\nfunction enableAllBtnTierExcept(tier) {\r\n    for (let i = 1; i <= 6; i += 1) {\r\n        if (tier === i) {\r\n            document.getElementById(`btn-tier-single-${i}`).disabled = true;\r\n        } else {\r\n            document.getElementById(`btn-tier-single-${i}`).disabled = false;\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n#### Actual Output\r\n<!-- If an error is thrown, please provide the stack trace here -->\r\n\r\n```js\r\nTypeError: unknown: Cannot convert undefined or null to object\r\n```\r\n\r\n#### Expected Output\r\n\r\n```js\r\nfunction enableAllBtnTierExcept(a){for(let b=1;6>=b;b+=1)a===b?document.getElementById(`btn-tier-single-${b}`).disabled=!0:document.getElementById(`btn-tier-single-${b}`).disabled=!1}\r\n```\r\n\r\n#### Details\r\n<!---\r\nAnything else at all\r\n-->\r\nPROBLEM with this line on else:\r\n```document.getElementById(`btn-tier-single-${i}`).disabled = false;```\r\n"},"comment":{"url":"https://api.github.com/repos/babel/minify/issues/comments/385908415","html_url":"https://github.com/babel/minify/issues/819#issuecomment-385908415","issue_url":"https://api.github.com/repos/babel/minify/issues/819","id":385908415,"user":{"login":"samuelcarreira","id":4456690,"avatar_url":"https://avatars1.githubusercontent.com/u/4456690?v=4","gravatar_id":"","url":"https://api.github.com/users/samuelcarreira","html_url":"https://github.com/samuelcarreira","followers_url":"https://api.github.com/users/samuelcarreira/followers","following_url":"https://api.github.com/users/samuelcarreira/following{/other_user}","gists_url":"https://api.github.com/users/samuelcarreira/gists{/gist_id}","starred_url":"https://api.github.com/users/samuelcarreira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samuelcarreira/subscriptions","organizations_url":"https://api.github.com/users/samuelcarreira/orgs","repos_url":"https://api.github.com/users/samuelcarreira/repos","events_url":"https://api.github.com/users/samuelcarreira/events{/privacy}","received_events_url":"https://api.github.com/users/samuelcarreira/received_events","type":"User","site_admin":false},"created_at":"2018-05-02T08:50:44Z","updated_at":"2018-05-02T08:50:44Z","author_association":"NONE","body":"@vigneshshanmugam here are the details:\r\n\r\n.babelrc\r\n```\r\n{\r\n    \"presets\": [\"babili\"],\r\n    \"plugins\": [\"transform-remove-console\"]\r\n}\r\n```\r\n\r\ngulp script\r\n```\r\ngulp.task(\"minify-js\", () => {\r\n  return gulp.src(paths.js)\r\n    .pipe(babili({\r\n      mangle: {\r\n        keepClassNames: true,\r\n        keepFnName: true,\r\n        comments: false\r\n      },\r\n      removeConsole: true\r\n    }))\r\n    .pipe(gulp.dest(\"app\"));\r\n});\r\n```\r\n\r\n"}}
{"actor":{"display_login":"samuelcarreira"}}