Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const from = 'compose';
- const to = 'pipe';
- export default (file, api) => {
- const j = api.jscodeshift;
- return j(file.source)
- .find(j.Identifier)
- .filter(i => i.value.name === from)
- .filter(i => i.parent.node.arguments)
- .forEach(i => {
- i.node.name = to;
- i.parent.node.arguments.reverse();
- })
- .toSource();
- };
Add Comment
Please, Sign In to add comment