id | title | sidebar_label | original_id |
---|---|---|---|
version-6.26.3-babel-plugin-minify-type-constructors |
babel-plugin-minify-type-constructors |
minify-type-constructors |
babel-plugin-minify-type-constructors |
In
Boolean(x);
Number(x);
String(x);
Array(3);
Array(3,1);
Object({foo: 'bar'});
Out
!!x;
+x;
x + "";
[,,,];
[3, 1];
{foo: 'bar'};
npm install babel-plugin-minify-type-constructors
{
"plugins": ["minify-type-constructors"]
}
babel --plugins minify-type-constructors script.js
require("babel-core").transform("code", {
plugins: ["minify-type-constructors"]
});
array
- prevent plugin from minifying arraysboolean
- prevent plugin from minifying booleansnumber
— prevent plugin from minifying numbersobject
— prevent plugin from minifying objectsstring
— prevent plugin from minifying strings
You can read more about configuring plugin options here