Created
March 12, 2020 13:28
-
-
Save jhd124/79e77be391a1b9aaafb30bab03b89bb3 to your computer and use it in GitHub Desktop.
This file contains 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
module.exports = function ({ parse }){ | |
return { | |
visitor: { | |
FunctionDeclaration(path){ | |
const node = path.node; | |
const functionName = node.id.name; | |
const consoleLogNode = parse(`console.log(${functionName})`); | |
path.get("body").unshiftContainer("body", consoleLogNode.program.body[0]); | |
}, | |
}, | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment