Socket
Socket
Sign inDemoInstall

babel-plugin-transform-remove-undefined

Package Overview
Dependencies
1
Maintainers
7
Versions
81
Alerts
File Explorer

Advanced tools

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


Version published
Weekly downloads
363K
decreased by-12.62%
Maintainers
7
Install size
22.1 kB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 24 Sep 2018

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc