Skip to content

Instantly share code, notes, and snippets.

@mzbac
Created June 22, 2017 12:23
Show Gist options
  • Select an option

  • Save mzbac/a4bb483c03431224c9e7e317e3f44ae8 to your computer and use it in GitHub Desktop.

Select an option

Save mzbac/a4bb483c03431224c9e7e317e3f44ae8 to your computer and use it in GitHub Desktop.
// Press ctrl+space for code completion
export default function transformer(file, api) {
const j = api.jscodeshift;
return j(file.source)
.find(j.CallExpression,{callee: {name: 'require'}})
.forEach(path => {
console.log(path.value.arguments[0].value);
path.value.arguments[0].value ='test';
})
.toSource();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment