{"action":"created","issue":{"url":"https://api.github.com/repos/lebab/lebab/issues/189","repository_url":"https://api.github.com/repos/lebab/lebab","labels_url":"https://api.github.com/repos/lebab/lebab/issues/189/labels{/name}","comments_url":"https://api.github.com/repos/lebab/lebab/issues/189/comments","events_url":"https://api.github.com/repos/lebab/lebab/issues/189/events","html_url":"https://github.com/lebab/lebab/pull/189","id":182179630,"number":189,"title":"Add support for forEach transformation","user":{"login":"aboyton","id":7865563,"avatar_url":"https://avatars.githubusercontent.com/u/7865563?v=3","gravatar_id":"","url":"https://api.github.com/users/aboyton","html_url":"https://github.com/aboyton","followers_url":"https://api.github.com/users/aboyton/followers","following_url":"https://api.github.com/users/aboyton/following{/other_user}","gists_url":"https://api.github.com/users/aboyton/gists{/gist_id}","starred_url":"https://api.github.com/users/aboyton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aboyton/subscriptions","organizations_url":"https://api.github.com/users/aboyton/orgs","repos_url":"https://api.github.com/users/aboyton/repos","events_url":"https://api.github.com/users/aboyton/events{/privacy}","received_events_url":"https://api.github.com/users/aboyton/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-10-11T05:52:21Z","updated_at":"2016-10-21T08:19:00Z","closed_at":"2016-10-21T08:19:00Z","pull_request":{"url":"https://api.github.com/repos/lebab/lebab/pulls/189","html_url":"https://github.com/lebab/lebab/pull/189","diff_url":"https://github.com/lebab/lebab/pull/189.diff","patch_url":"https://github.com/lebab/lebab/pull/189.patch"},"body":"This adds support for transforming simple for loops into `forEach` loops #188.\r\n\r\nThis builds on the code for transforming for loops into `for-each` loops and refactors the code to share as much as possible.\r\n\r\nThis code adds the index and array as required.\r\n\r\nTo simplifiy the transformation of old code by allowing the author to name the loop variable at the start of the code and then lebab will do this rewriting in the rest of the loop.\r\n\r\nSo, taking the example from #169.\r\n\r\n```js\r\nfor (let i = 0; i < fruits.length; i++) {\r\n   let fruitItem = fruits[i];\r\n   console.log(fruits[i]);\r\n}\r\n// -->\r\nfruits.forEach(fruitItem => {\r\n   console.log(fruitItem);\r\n});\r\n```\r\n\r\nor a more complicated example\r\n\r\n```js\r\nfor (let i = 0; i < xs.length; i++) {\r\n  const x = xs[i];\r\n  console.log(xs[i]);\r\n  for (let j = 0; j < xs[i].length; j++) {\r\n    const y = xs[i][j];\r\n    console.log(xs[i][j]);\r\n  }\r\n}\r\n// -->\r\nxs.forEach(x => {\r\n  console.log(x);\r\n  x.forEach(y => {\r\n    console.log(y);\r\n  });\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/lebab/lebab/issues/comments/255322338","html_url":"https://github.com/lebab/lebab/pull/189#issuecomment-255322338","issue_url":"https://api.github.com/repos/lebab/lebab/issues/189","id":255322338,"user":{"login":"nene","id":118201,"avatar_url":"https://avatars.githubusercontent.com/u/118201?v=3","gravatar_id":"","url":"https://api.github.com/users/nene","html_url":"https://github.com/nene","followers_url":"https://api.github.com/users/nene/followers","following_url":"https://api.github.com/users/nene/following{/other_user}","gists_url":"https://api.github.com/users/nene/gists{/gist_id}","starred_url":"https://api.github.com/users/nene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nene/subscriptions","organizations_url":"https://api.github.com/users/nene/orgs","repos_url":"https://api.github.com/users/nene/repos","events_url":"https://api.github.com/users/nene/events{/privacy}","received_events_url":"https://api.github.com/users/nene/received_events","type":"User","site_admin":false},"created_at":"2016-10-21T08:19:00Z","updated_at":"2016-10-21T08:19:00Z","body":"This looks pretty good now.\r\n\r\nI improved the tests and merged this in."}}
{"actor":{"display_login":"nene"}}