babel-plugin-undefined-to-void

Replace references to `undefined` with `void 0`

MIT 9 个版本
安装
npm install babel-plugin-undefined-to-void
yarn add babel-plugin-undefined-to-void
pnpm add babel-plugin-undefined-to-void
bun add babel-plugin-undefined-to-void
README

babel-plugin-undefined-to-void

Some JavaScript implementations allow undefined to be overwritten, this may lead to peculiar bugs that are extremely hard to track down.

This plugin transforms undefined into void 0 which returns undefined regardless of if it's been reassigned.

Example

In

foo === undefined;

Out

foo === void 0;

Installation

$ npm install babel-plugin-undefined-to-void

Usage

.babelrc

{
  "plugins": ["undefined-to-void"]
}

Via CLI

$ babel --plugins undefined-to-void script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["undefined-to-void"]
});
版本列表
1.1.6 2015-06-15
1.1.5 2015-06-15
1.1.4 2015-06-15
1.1.3 2015-06-15
1.1.2 2015-06-15
1.1.1 2015-06-15
1.1.0 2015-06-15
1.0.3 2015-06-15
1.0.2 2015-06-15