例如,设置MYCONST = true
将导致转换
if (MYCONST) {
console.log('MYCONST IS TRUE!'); // print important message
}
到
if (true) {
console.log('MYCONST IS TRUE!'); // print important message
}
理想情况下,此工具具有可快速访问的 node.js API。
最佳答案
一个更好的方法来实现你想要的 -
设置.js
settings = {
MYCONST = true
};
主代码.js
if (settings.MYCONST) {
console.log('MYCONST IS TRUE!'); // print important message
}
通过这种方式,您可以对一个文件进行更改。
关于node.js - 是否有任何快速工具可以在不删除 JavaScript 源代码注释的情况下执行常量替换?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8582798/