New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

strip-debug

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strip-debug

Strip console, alert, and debugger statements from JavaScript code

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.8K
decreased by-15.12%
Maintainers
1
Weekly downloads
 
Created
Source

strip-debug Build Status

Strip console, alert, and debugger statements from JavaScript code

Useful for making sure you didn't leave any logging in production code.

Also available as gulp/grunt/broccoli plugins.

Install

$ npm install --save strip-debug

Usage

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

You can also use it as a CLI app by installing it globally:

$ npm install --global strip-debug
Usage
$ 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

Keywords

FAQs

Package last updated on 26 Jul 2014

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc