{"action":"closed","issue":{"url":"https://api.github.com/repos/babel/babel/issues/2433","labels_url":"https://api.github.com/repos/babel/babel/issues/2433/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel/issues/2433/comments","events_url":"https://api.github.com/repos/babel/babel/issues/2433/events","html_url":"https://github.com/babel/babel/issues/2433","id":108484829,"number":2433,"title":"Trampolining? Can cause invalid js expecting block scopes to be hoisted","user":{"login":"togakangaroo","id":66150,"avatar_url":"https://avatars.githubusercontent.com/u/66150?v=3","gravatar_id":"","url":"https://api.github.com/users/togakangaroo","html_url":"https://github.com/togakangaroo","followers_url":"https://api.github.com/users/togakangaroo/followers","following_url":"https://api.github.com/users/togakangaroo/following{/other_user}","gists_url":"https://api.github.com/users/togakangaroo/gists{/gist_id}","starred_url":"https://api.github.com/users/togakangaroo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/togakangaroo/subscriptions","organizations_url":"https://api.github.com/users/togakangaroo/orgs","repos_url":"https://api.github.com/users/togakangaroo/repos","events_url":"https://api.github.com/users/togakangaroo/events{/privacy}","received_events_url":"https://api.github.com/users/togakangaroo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-26T18:13:23Z","updated_at":"2015-09-26T18:22:24Z","closed_at":"2015-09-26T18:22:24Z","body":"I have the following options blacklisted\r\n\r\n\t    \"blacklist\": [\r\n\t      'regenerator',\r\n\t      'es6.constants',\r\n\t      'es6.forOf',\r\n\t    ]\r\n\r\nSpecifically - since I'm using chrome, no need to transform the supported const keyword.\r\n\r\nI wrote a function that looks like this:\r\n\r\n\tconst getValue = (model, propertyPath) => {\r\n\t\tif(!propertyPath || propertyPath == '*')\r\n\t\t\treturn model\r\n\t\tif(_.isUndefined(model) || model === null)\r\n\t\t\treturn model //No such model, should this be an error?\r\n\t\tif(model.hasOwnProperty(propertyPath))\r\n\t\t\treturn model[propertyPath]\r\n\t\tconst [head, ...tail] = (propertyPath||'').split('.')\r\n\t\tif(!head)\r\n\t\t\treturn undefined; //Property does not exist, Maybe should be an error? \r\n\t\treturn getValue(model[head], tail.join('.'))\r\n\t}\r\n\r\nwhich compiles into\r\n\r\n\t\t\t\tconst getValue = function getValue(_x8, _x9) {\r\n\t\t\t\t\tvar _again = true;\r\n\r\n\t\t\t\t\t_function: while (_again) {\r\n\t\t\t\t\t\tvar model = _x8,\r\n\t\t\t\t\t\t    propertyPath = _x9;\r\n\t\t\t\t\t\t_split = _split2 = head = tail = undefined;\r\n\t\t\t\t\t\t_again = false;\r\n\r\n\t\t\t\t\t\tif (!propertyPath || propertyPath == '*') return model;\r\n\t\t\t\t\t\tif (_.isUndefined(model) || model === null) return model; //No such model, should this be an error?\r\n\t\t\t\t\t\tif (model.hasOwnProperty(propertyPath)) return model[propertyPath];\r\n\r\n\t\t\t\t\t\tvar _split = (propertyPath || '').split('.');\r\n\r\n\t\t\t\t\t\tvar _split2 = _toArray(_split);\r\n\r\n\t\t\t\t\t\tconst head = _split2[0];\r\n\r\n\t\t\t\t\t\tconst tail = _split2.slice(1);\r\n\r\n\t\t\t\t\t\tif (!head) return undefined; //Property does not exist, Maybe should be an error?\r\n\t\t\t\t\t\t_x8 = model[head];\r\n\t\t\t\t\t\t_x9 = tail.join('.');\r\n\t\t\t\t\t\t_again = true;\r\n\t\t\t\t\t\tcontinue _function;\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\r\nNote that at the top, we assign undefined to `tail` but it's only declared by `const` further down. Since `const` is block scoped this will break."}}