Package Exports
- strip-debug
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (strip-debug) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
strip-debug 
Strip
console
,alert
, anddebugger
statements from JavaScript code
Useful for making sure you didn't leave any logging in production code.
Also available as gulp/grunt/broccoli plugins.
Usage
$ npm install --save strip-debug
var stripDebug = require('strip-debug');
stripDebug('function foo(){console.log("foo");alert("foo");debugger;}').toString();
//=> function foo(){void 0;void 0;}
API
stripDebug(input)
Returns the modified Esprima AST which can be used to make additional modifications.
Call .toString()
to get the stringified output.
To prevent any side-effects, console.*
/alert*
is replaced with void 0
instead of being stripped.
input
Type: string
, object
Pass in a string of JavaScript code or a Esprima compatible AST.
CLI
$ npm install --global strip-debug
$ strip-debug src/app.js > dist/app.js
or pipe something to it:
$ echo 'function foo(){console.log("bar")}' | strip-debug
#=> function foo(){}
License
MIT © Sindre Sorhus