Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

babel-plugin-constif

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-constif

This plugin allows Babel to remove remove if conditionals with string literals as condition.

Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-constif

This plugin allows Babel to remove remove if conditionals with string literals as condition.

Example

In

if ("isDebug")
	console.log(1);
else
	console.log(2);

Out

// IS_DEBUG=true babel script.js
console.log(1);

// IS_DEBUG=false babel script.js
console.log(2);

// babel script.js
if ("isDebug")
	console.log(1);
else
	console.log(2);

Installation

npm install --save-dev babel-plugin-constif

Usage

.babelrc

{
  "plugins": [
    ["constif", {var1: true, var2:false}]
  ]
}

Via CLI

VAR1=true VAR2=0 babel --plugins constif script.js

Via Node API

require("babel-core").transform("code", {
  plugins: [
    ["constif", {var1: true, var2:false}]
  ]
});

Keywords

babel-plugin

FAQs

Package last updated on 16 May 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