【文件属性】:
文件名称:js-codemod:Codemod脚本将代码转换为下一代JS
文件大小:129KB
文件格式:ZIP
更新时间:2021-04-06 00:41:06
JavaScript
js-codemod
这个库包含有使用codemod脚本的集合 。
设置和运行
npm install -g jscodeshift
git clone https://github.com/cpojer/js-codemod.git
jscodeshift -t < codemod> < file>
使用-d选项进行空运行,并使用-p打印输出以进行比较。
包含的脚本
arrow-function-arguments
jscodeshift -t js-codemod/transforms/arrow-function-arguments.js < file>
arrow-function
变换回调只有当它能够保证它不会打破this在功能方面。 function() { }.bind(this)调用转换为() => {} 。
jscodeshift -t js