需求是这样的,要在ts代码中插入let self = this,然后吧this 替换为self,以方便后期工具压缩代码;
想找个能分析TS(类似JS ast语法树这种)代码的工具统一插入;
private test():void{
this.a = 1;
this.b = 1;
this.c = 1;
this.d = 1;
//......
}
替换成变成
private test():void{
let self = this;
self .a = 1;
self .b = 1;
self .c = 1;
self .d = 1;
//......
}
把
this
替换成self
方便压缩代码?替换成_
不是更好么……而且这种事情不是应该压缩工具来干么?