Skip to content

Instantly share code, notes, and snippets.

@patocallaghan
Created July 31, 2018 10:07
Show Gist options
  • Save patocallaghan/6fd06d8f222c3e6c42782705886a9299 to your computer and use it in GitHub Desktop.
Save patocallaghan/6fd06d8f222c3e6c42782705886a9299 to your computer and use it in GitHub Desktop.
export default function transformer(file, api) {
const j = api.jscodeshift;
return j(file.source)
.find(j.Identifier)
.forEach(path => {
j(path).replaceWith(
j.identifier(path.node.name.split('').reverse().join(''))
);
})
.toSource({ quote: 'double' });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment