{"action":"closed","issue":{"url":"https://api.github.com/repos/babel/babel/issues/838","labels_url":"https://api.github.com/repos/babel/babel/issues/838/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel/issues/838/comments","events_url":"https://api.github.com/repos/babel/babel/issues/838/events","html_url":"https://github.com/babel/babel/issues/838","id":58265095,"number":838,"title":"Closing iterators","user":{"login":"rauschma","id":526114,"avatar_url":"https://avatars.githubusercontent.com/u/526114?v=3","gravatar_id":"","url":"https://api.github.com/users/rauschma","html_url":"https://github.com/rauschma","followers_url":"https://api.github.com/users/rauschma/followers","following_url":"https://api.github.com/users/rauschma/following{/other_user}","gists_url":"https://api.github.com/users/rauschma/gists{/gist_id}","starred_url":"https://api.github.com/users/rauschma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rauschma/subscriptions","organizations_url":"https://api.github.com/users/rauschma/orgs","repos_url":"https://api.github.com/users/rauschma/repos","events_url":"https://api.github.com/users/rauschma/events{/privacy}","received_events_url":"https://api.github.com/users/rauschma/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/babel/babel/labels/high%20priority","name":"high priority","color":"fbca04"},{"url":"https://api.github.com/repos/babel/babel/labels/spec%20compliancy","name":"spec compliancy","color":"0052cc"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-19T20:29:15Z","updated_at":"2015-02-21T02:31:18Z","closed_at":"2015-02-21T02:31:18Z","body":"In the latest spec, `for-of` (and others) close iterators (by calling `someIterator.return()`).\r\n\r\n```js\r\nfunction* foo() {\r\n  yield 'a';\r\n  yield 'b';\r\n}\r\nfoo.prototype.return = function (...args) {\r\n  console.log('RETURN');\r\n  return super.return(...args);\r\n};\r\nfor (let x of foo()) {\r\n  console.log(x);\r\n  break; // should trigger `return` method\r\n}\r\n```"}}