Babel
  • Docs
  • Setup
  • Try it out
  • Videos
  • Blog
  • Donate
  • Team
  • GitHub
Edit

babel-plugin-minify-type-constructors

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

With a configuration file (Recommended)

{
  "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

You can read more about configuring plugin options here

  • Example
  • Installation
  • Usage
    • With a configuration file (Recommended)
    • Via CLI
    • Via Node API
  • Options
Babel
Docs
Learn ES2015
Community
VideosUser ShowcaseStack OverflowSlack ChannelTwitter
More
BlogGitHub OrgGitHub RepoWebsite RepoOld 6.x SiteOld 5.x Site