Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

babel-plugin-transform-remove-undefined

Package Overview
Dependencies
Maintainers
7
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-remove-undefined

This removes rvals that are equivalent to undefined wherever possible

latest
Source
npmnpm
Version
0.5.0
Version published
Weekly downloads
507K
22.87%
Maintainers
7
Weekly downloads
 
Created
Source

babel-plugin-transform-remove-undefined

For variable assignments, this removes rvals that evaluate to undefined (vars in functions only). For functions, this removes return arguments that evaluate to undefined.

Example

In

let a = void 0;
function foo() {
  var b = undefined;
  return undefined;
}

Out

let a;
function foo() {
  var b;
  return;
}

Installation

npm install babel-plugin-transform-remove-undefined --save-dev

Usage

.babelrc

{
  "plugins": ["babel-plugin-transform-remove-undefined"]
}

Via CLI

babel --plugins babel-plugin-transform-remove-undefined script.js

Via Node API

require("@babel/core").transform("code", {
  plugins: ["babel-plugin-transform-remove-undefined"]
});

Options

  • tdz - Detect usages before declaration/initialization in let/const(throws) and var(void 0)

Keywords

babel-plugin

FAQs

Package last updated on 24 Sep 2018

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