babel-plugin-minify-type-constructors

babel
js
babel-plugin-minify-type-constructors JS library homepage babel-plugin-minify-type-constructors JS library on GitHub babel-plugin-minify-type-constructors JS library on npm Download babel-plugin-minify-type-constructors JS library

**Note:** Not recommended if full support for IE8 and lower is required. [Details](https://github.com/babel/minify/pull/45#discussion_r70181249)

Version 0.4.3 License MIT
babel-plugin-minify-type-constructors JS library homepage
babel-plugin-minify-type-constructors JS library on GitHub
babel-plugin-minify-type-constructors JS library on npm
Download babel-plugin-minify-type-constructors JS library
Keywords
babel-plugin
Learn more

babel-plugin-minify-type-constructors

Note: Not recommended if full support for IE8 and lower is required. Details

Example

In

Boolean(x);
Number(x);
String(x);
Array(3);
Array(3,1);
Object({foo: 'bar'});

Out

!!x;
+x;
x + "";
[,,,];
[3, 1];
{foo: 'bar'};

Installation

npm install babel-plugin-minify-type-constructors --save-dev

Usage

.babelrc

{
  "plugins": ["minify-type-constructors"]
}

Via CLI

babel --plugins minify-type-constructors script.js

Via Node API

require("@babel/core").transform("code", {
  plugins: ["minify-type-constructors"]
});

Options

  • array - prevent plugin from minifying arrays
  • boolean - prevent plugin from minifying booleans
  • number — prevent plugin from minifying numbers
  • object — prevent plugin from minifying objects
  • string — prevent plugin from minifying strings