{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/jscodeshift/issues/66","labels_url":"https://api.github.com/repos/facebook/jscodeshift/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/facebook/jscodeshift/issues/66/comments","events_url":"https://api.github.com/repos/facebook/jscodeshift/issues/66/events","html_url":"https://github.com/facebook/jscodeshift/issues/66","id":114860239,"number":66,"title":"Re-use old AST","user":{"login":"OliverJAsh","id":921609,"avatar_url":"https://avatars.githubusercontent.com/u/921609?v=3","gravatar_id":"","url":"https://api.github.com/users/OliverJAsh","html_url":"https://github.com/OliverJAsh","followers_url":"https://api.github.com/users/OliverJAsh/followers","following_url":"https://api.github.com/users/OliverJAsh/following{/other_user}","gists_url":"https://api.github.com/users/OliverJAsh/gists{/gist_id}","starred_url":"https://api.github.com/users/OliverJAsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OliverJAsh/subscriptions","organizations_url":"https://api.github.com/users/OliverJAsh/orgs","repos_url":"https://api.github.com/users/OliverJAsh/repos","events_url":"https://api.github.com/users/OliverJAsh/events{/privacy}","received_events_url":"https://api.github.com/users/OliverJAsh/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/jscodeshift/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-03T16:54:27Z","updated_at":"2015-11-03T17:48:45Z","closed_at":"2015-11-03T17:48:43Z","body":"When transforming the AST, it would be useful to re-use part of the old AST so I don't have to manually reconstruct all nodes nested in the part I'm transforming:\r\n\r\n``` js\r\nmodule.exports = function(file, api) {\r\n  const j = api.jscodeshift;\r\n  const {expression, statement, statements} = j.template;\r\n\r\n  return j(file.source)\r\n    .find(j.Identifier)\r\n    .replaceWith(\r\n      p => j.memberExpression(j.identifier('foo'), p)\r\n    )\r\n    .toSource();\r\n};\r\n\r\n```\r\n\r\nIs this possible?"},"comment":{"url":"https://api.github.com/repos/facebook/jscodeshift/issues/comments/153430946","html_url":"https://github.com/facebook/jscodeshift/issues/66#issuecomment-153430946","issue_url":"https://api.github.com/repos/facebook/jscodeshift/issues/66","id":153430946,"user":{"login":"OliverJAsh","id":921609,"avatar_url":"https://avatars.githubusercontent.com/u/921609?v=3","gravatar_id":"","url":"https://api.github.com/users/OliverJAsh","html_url":"https://github.com/OliverJAsh","followers_url":"https://api.github.com/users/OliverJAsh/followers","following_url":"https://api.github.com/users/OliverJAsh/following{/other_user}","gists_url":"https://api.github.com/users/OliverJAsh/gists{/gist_id}","starred_url":"https://api.github.com/users/OliverJAsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OliverJAsh/subscriptions","organizations_url":"https://api.github.com/users/OliverJAsh/orgs","repos_url":"https://api.github.com/users/OliverJAsh/repos","events_url":"https://api.github.com/users/OliverJAsh/events{/privacy}","received_events_url":"https://api.github.com/users/OliverJAsh/received_events","type":"User","site_admin":false},"created_at":"2015-11-03T17:48:45Z","updated_at":"2015-11-03T17:48:45Z","body":"Thanks!"}}