{"action":"created","comment":{"url":"https://api.github.com/repos/Shopify/javascript/pulls/comments/66902121","id":66902121,"diff_hunk":"@@ -0,0 +1,48 @@\n+export default function iifeToTernaryExpression({source}, {jscodeshift: j}, {printOptions = {}}) {\n+  function isImmediatelyInvokedFunctionExpression(expressionPath) {\n+    let expression = expressionPath.node.expression","path":"packages/shopify-codemod/transforms/iife-to-ternary-expression.js","position":3,"original_position":3,"commit_id":"15ef38f478cb4675d71904a2c4537212c171e60c","original_commit_id":"15ef38f478cb4675d71904a2c4537212c171e60c","user":{"login":"GoodForOneFare","id":673655,"avatar_url":"https://avatars.githubusercontent.com/u/673655?v=3","gravatar_id":"","url":"https://api.github.com/users/GoodForOneFare","html_url":"https://github.com/GoodForOneFare","followers_url":"https://api.github.com/users/GoodForOneFare/followers","following_url":"https://api.github.com/users/GoodForOneFare/following{/other_user}","gists_url":"https://api.github.com/users/GoodForOneFare/gists{/gist_id}","starred_url":"https://api.github.com/users/GoodForOneFare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoodForOneFare/subscriptions","organizations_url":"https://api.github.com/users/GoodForOneFare/orgs","repos_url":"https://api.github.com/users/GoodForOneFare/repos","events_url":"https://api.github.com/users/GoodForOneFare/events{/privacy}","received_events_url":"https://api.github.com/users/GoodForOneFare/received_events","type":"User","site_admin":false},"body":"You can use `const` here.  This is probably causing a CI failure.\r\n\r\nI recommend adding adding a Git pre-push hook to prevent minor stuff reaching review.  Steps for that: \r\n\r\n* Go to your `shopify/javascript` dir\r\n* `echo 'cd packages/shopify-codemod && npm test' > .git/hooks/pre-push`\r\n\r\nThis'll run the codemod tests, every time you try to git push, and back out if the tests/linting fail.","created_at":"2016-06-14T02:48:52Z","updated_at":"2016-06-14T02:48:52Z","html_url":"https://github.com/Shopify/javascript/pull/169#discussion_r66902121","pull_request_url":"https://api.github.com/repos/Shopify/javascript/pulls/169","_links":{"self":{"href":"https://api.github.com/repos/Shopify/javascript/pulls/comments/66902121"},"html":{"href":"https://github.com/Shopify/javascript/pull/169#discussion_r66902121"},"pull_request":{"href":"https://api.github.com/repos/Shopify/javascript/pulls/169"}}},"pull_request":{"url":"https://api.github.com/repos/Shopify/javascript/pulls/169","id":73663038,"html_url":"https://github.com/Shopify/javascript/pull/169","diff_url":"https://github.com/Shopify/javascript/pull/169.diff","patch_url":"https://github.com/Shopify/javascript/pull/169.patch","issue_url":"https://api.github.com/repos/Shopify/javascript/issues/169","number":169,"state":"open","locked":false,"title":"Added IIFE to Ternary transform","user":{"login":"justinthec","id":2578036,"avatar_url":"https://avatars.githubusercontent.com/u/2578036?v=3","gravatar_id":"","url":"https://api.github.com/users/justinthec","html_url":"https://github.com/justinthec","followers_url":"https://api.github.com/users/justinthec/followers","following_url":"https://api.github.com/users/justinthec/following{/other_user}","gists_url":"https://api.github.com/users/justinthec/gists{/gist_id}","starred_url":"https://api.github.com/users/justinthec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinthec/subscriptions","organizations_url":"https://api.github.com/users/justinthec/orgs","repos_url":"https://api.github.com/users/justinthec/repos","events_url":"https://api.github.com/users/justinthec/events{/privacy}","received_events_url":"https://api.github.com/users/justinthec/received_events","type":"User","site_admin":false},"body":"Turns:\r\n```js\r\n(() => {\r\n  if (foo) {\r\n    return bar;\r\n  } else {\r\n    return baz;\r\n  }\r\n})();\r\n```\r\n\r\ninto\r\n\r\n```js\r\n(() => {\r\n  (foo ? bar : baz);\r\n})();\r\n```\r\n\r\nIf there a way I can just modify the body of a `Node` and then return the original `node`?\r\nWhen I try \r\n```js\r\nlet ternaryExpression = j.conditionalExpression(test, consequentIdentifier, alternateIdentifier);\r\nfunctionBlockStatement.body = [ternaryExpression];\r\n\r\nreturn node;\r\n```\r\nI get this error:\r\n```\r\n{test: [object Object], consequent: [object Object], alternate: [object Object], loc: null, type: ConditionalExpression, comments: null} does not match type string\r\n```\r\n\r\nAlso should I be using destructuring assignments for the initial search of nodes?\r\n\r\n@lemonmade @fandy @GoodForOneFare ","created_at":"2016-06-14T00:15:11Z","updated_at":"2016-06-14T02:48:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c2e18d86d221cc657f45829e6dbcb52188749a03","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Shopify/javascript/pulls/169/commits","review_comments_url":"https://api.github.com/repos/Shopify/javascript/pulls/169/comments","review_comment_url":"https://api.github.com/repos/Shopify/javascript/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Shopify/javascript/issues/169/comments","statuses_url":"https://api.github.com/repos/Shopify/javascript/statuses/15ef38f478cb4675d71904a2c4537212c171e60c","head":{"label":"Shopify:iife-to-ternary","ref":"iife-to-ternary","sha":"15ef38f478cb4675d71904a2c4537212c171e60c","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":49887169,"name":"javascript","full_name":"Shopify/javascript","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/javascript","description":"The home for all things JavaScript at Shopify.","fork":false,"url":"https://api.github.com/repos/Shopify/javascript","forks_url":"https://api.github.com/repos/Shopify/javascript/forks","keys_url":"https://api.github.com/repos/Shopify/javascript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/javascript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/javascript/teams","hooks_url":"https://api.github.com/repos/Shopify/javascript/hooks","issue_events_url":"https://api.github.com/repos/Shopify/javascript/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/javascript/events","assignees_url":"https://api.github.com/repos/Shopify/javascript/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/javascript/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/javascript/tags","blobs_url":"https://api.github.com/repos/Shopify/javascript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/javascript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/javascript/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/javascript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/javascript/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/javascript/languages","stargazers_url":"https://api.github.com/repos/Shopify/javascript/stargazers","contributors_url":"https://api.github.com/repos/Shopify/javascript/contributors","subscribers_url":"https://api.github.com/repos/Shopify/javascript/subscribers","subscription_url":"https://api.github.com/repos/Shopify/javascript/subscription","commits_url":"https://api.github.com/repos/Shopify/javascript/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/javascript/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/javascript/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/javascript/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/javascript/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/javascript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/javascript/merges","archive_url":"https://api.github.com/repos/Shopify/javascript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/javascript/downloads","issues_url":"https://api.github.com/repos/Shopify/javascript/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/javascript/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/javascript/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/javascript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/javascript/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/javascript/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/javascript/deployments","created_at":"2016-01-18T15:54:37Z","updated_at":"2016-06-06T17:49:10Z","pushed_at":"2016-06-14T00:16:02Z","git_url":"git://github.com/Shopify/javascript.git","ssh_url":"git@github.com:Shopify/javascript.git","clone_url":"https://github.com/Shopify/javascript.git","svn_url":"https://github.com/Shopify/javascript","homepage":null,"size":535,"stargazers_count":26,"watchers_count":26,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":30,"forks":2,"open_issues":30,"watchers":26,"default_branch":"master"}},"base":{"label":"Shopify:master","ref":"master","sha":"bbf5f9c236ceec5c527bbfa708a35c88d7b85914","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":49887169,"name":"javascript","full_name":"Shopify/javascript","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/javascript","description":"The home for all things JavaScript at Shopify.","fork":false,"url":"https://api.github.com/repos/Shopify/javascript","forks_url":"https://api.github.com/repos/Shopify/javascript/forks","keys_url":"https://api.github.com/repos/Shopify/javascript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/javascript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/javascript/teams","hooks_url":"https://api.github.com/repos/Shopify/javascript/hooks","issue_events_url":"https://api.github.com/repos/Shopify/javascript/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/javascript/events","assignees_url":"https://api.github.com/repos/Shopify/javascript/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/javascript/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/javascript/tags","blobs_url":"https://api.github.com/repos/Shopify/javascript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/javascript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/javascript/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/javascript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/javascript/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/javascript/languages","stargazers_url":"https://api.github.com/repos/Shopify/javascript/stargazers","contributors_url":"https://api.github.com/repos/Shopify/javascript/contributors","subscribers_url":"https://api.github.com/repos/Shopify/javascript/subscribers","subscription_url":"https://api.github.com/repos/Shopify/javascript/subscription","commits_url":"https://api.github.com/repos/Shopify/javascript/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/javascript/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/javascript/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/javascript/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/javascript/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/javascript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/javascript/merges","archive_url":"https://api.github.com/repos/Shopify/javascript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/javascript/downloads","issues_url":"https://api.github.com/repos/Shopify/javascript/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/javascript/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/javascript/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/javascript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/javascript/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/javascript/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/javascript/deployments","created_at":"2016-01-18T15:54:37Z","updated_at":"2016-06-06T17:49:10Z","pushed_at":"2016-06-14T00:16:02Z","git_url":"git://github.com/Shopify/javascript.git","ssh_url":"git@github.com:Shopify/javascript.git","clone_url":"https://github.com/Shopify/javascript.git","svn_url":"https://github.com/Shopify/javascript","homepage":null,"size":535,"stargazers_count":26,"watchers_count":26,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":30,"forks":2,"open_issues":30,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Shopify/javascript/pulls/169"},"html":{"href":"https://github.com/Shopify/javascript/pull/169"},"issue":{"href":"https://api.github.com/repos/Shopify/javascript/issues/169"},"comments":{"href":"https://api.github.com/repos/Shopify/javascript/issues/169/comments"},"review_comments":{"href":"https://api.github.com/repos/Shopify/javascript/pulls/169/comments"},"review_comment":{"href":"https://api.github.com/repos/Shopify/javascript/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Shopify/javascript/pulls/169/commits"},"statuses":{"href":"https://api.github.com/repos/Shopify/javascript/statuses/15ef38f478cb4675d71904a2c4537212c171e60c"}}}}
{"actor":{"display_login":"GoodForOneFare"}}