Last active
December 1, 2017 08:39
-
-
Save perjansson/553cb4b28af60955909915ceefc86ceb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const transformer = (file, api) => { | |
| /* get the jscodeshift helper */ | |
| const j = api.jscodeshift; | |
| /* create a js object representation of your source code */ | |
| const root = j(file.source); | |
| return root | |
| .find(/* grab the code you want to update */) | |
| .forEach(/* do something to it */) | |
| .toSource(/* return the newly printed code */); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment