🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

babel-plugin-strip-module

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-strip-module

Babel plugin that strip certain module usage in code

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

babel-plugin-strip-module

Babel plugin that will remove certain module usage from code.

Using this plugin might be dangourse as it will remove code that you might want to keep. Use at your own risk.

Examples

Suppose you would like to remove certain validation library in production code. Here is what this plugin can do:

In

import * as paramTypes from 'param-types';

const validation = paramTypes.validate(
  'function validation',
  paramTypes.string.isRequired,
  paramTypes.number.isRequired
);

function regularFunction(paramA, paramB) {
  validate(paramA, paramB);
  console.log('do something normal here');
}

regularFunction('1', 1);

Out

/* import * as paramTypes from 'param-types'; */

/*
 * const validation = paramTypes.validate(
 *   'function validation',
 *   paramTypes.string.isRequired,
 *   paramTypes.number.isRequired
 * );
 */

function regularFunction(paramA, paramB) {
  /* validate(paramA, paramB); */
  console.log('do something normal here');
}

regularFunction('1', 1);

Installation

$ npm install babel-plugin-strip-module

Usage

.babelrc

{
  "plugins": [["strip-module", { "modules": ["module name here"] }]]
}

Via Node API

require('babel-core').transform('code', {
  plugins: [['strip-module', { modules: ['module name here'] }]],
});

License

MIT

Keywords

strip

FAQs

Package last updated on 07 Feb 2017

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