The Rocambole project is no longer maintained.
Strip console statements from a
rocambole
AST
$ npm install rocambole-strip-console
const rocambole = require('rocambole');
const stripconsole = require('rocambole-strip-console');
rocambole.moonwalk('if (true) { console.log("foo"); }', node => {
stripConsole(node);
}).toString();
//=> 'if (true) { void 0; }'
To prevent any side-effects, console.*
is replaced with void 0
instead of being removed.
MIT © Sindre Sorhus