{"action":"closed","issue":{"url":"https://api.github.com/repos/babel/babel/issues/5907","repository_url":"https://api.github.com/repos/babel/babel","labels_url":"https://api.github.com/repos/babel/babel/issues/5907/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel/issues/5907/comments","events_url":"https://api.github.com/repos/babel/babel/issues/5907/events","html_url":"https://github.com/babel/babel/issues/5907","id":239882063,"number":5907,"title":"When trying to destructure parameter in a function call, getting unexpected output.","user":{"login":"karthiick","id":7686597,"avatar_url":"https://avatars0.githubusercontent.com/u/7686597?v=3","gravatar_id":"","url":"https://api.github.com/users/karthiick","html_url":"https://github.com/karthiick","followers_url":"https://api.github.com/users/karthiick/followers","following_url":"https://api.github.com/users/karthiick/following{/other_user}","gists_url":"https://api.github.com/users/karthiick/gists{/gist_id}","starred_url":"https://api.github.com/users/karthiick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karthiick/subscriptions","organizations_url":"https://api.github.com/users/karthiick/orgs","repos_url":"https://api.github.com/users/karthiick/repos","events_url":"https://api.github.com/users/karthiick/events{/privacy}","received_events_url":"https://api.github.com/users/karthiick/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-06-30T20:33:15Z","updated_at":"2017-06-30T20:57:38Z","closed_at":"2017-06-30T20:57:38Z","body":"Given:\r\n\r\n```js\r\nlet y = { a: 'a', b: 'b', c: 'c'};\r\nconsole.log({\r\n  a,\r\n  b\r\n} = y);\r\n```\r\n\r\nActual:\r\n```\r\nvar _y;\r\n\r\nvar y = { a: 'a', b: 'b', c: 'c' };\r\nconsole.log((_y = y, a = _y.a, b = _y.b, _y));\r\n```\r\n\r\nActual Output: \r\n`a is not defined`\r\n\r\nExpected Output:\r\n```\r\nObject {\r\n  \"a\": \"a\",\r\n  \"b\": \"b\",\r\n  \"c\": \"c\"\r\n}\r\n```\r\n\r\nTried the same in chrome console and it works just fine.\r\n\r\nMy actual use case is, get a set of properties from an object & set those properties to another object.\r\n\r\n```\r\nlet { a, b, c, d} = m;\r\nn.setProperties({\r\n a,\r\n b,\r\n c,\r\n d\r\n});\r\n```\r\nto\r\n\r\n```\r\nn.setProperties({\r\n a,\r\n b,\r\n c,\r\n d\r\n} = m);\r\n```\r\nThe second form seems simpler & reduces one line."}}
{"actor":{"display_login":"karthiick"}}