change the this of code

npm install ast-replace-this
6 downloads in the last week
10 downloads in the last month


Replaces the this variable with the given expression. Consumes/produces Mozilla ASTs.


replaceThis(Node, replacement, recurse = false) -> Node

Returns a new AST with all ThisExpressions replaced with the given expression. If recurse is truthy, it will recurse to cover every scope in the AST.

npm loves you