
Product
Introducing Module Reachability: Focus on the Vulnerabilities That Matter
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.
strip-debug-option
Advanced tools
Strip console, alert, and debugger statements from JavaScript code
Strip
console
,alert
, anddebugger
statements from JavaScript code
Useful for making sure you didn't leave any logging in production code.
$ npm install strip-debug-option
const stripDebug = require('strip-debug-option');
const option={
skipDebugger:false,
skipConsole:false,
skipAlert:false
}
stripDebug('function foo(){console.log("foo");alert("foo");debugger;}',option).toString();
//=> 'function foo(){void 0;void 0;}'
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.
If you shadow the console
global with your own local variable, it will still be removed.
Type: string
Object
Pass in a string of JavaScript code or a Esprima compatible AST.
MIT
FAQs
Strip console, alert, and debugger statements from JavaScript code
The npm package strip-debug-option receives a total of 255 weekly downloads. As such, strip-debug-option popularity was classified as not popular.
We found that strip-debug-option demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.
Company News
Socket is bringing best-in-class reachability analysis into the platform — cutting false positives, accelerating triage, and cementing our place as the leader in software supply chain security.
Product
Socket is introducing a new way to organize repositories and apply repository-specific security policies.