Skip to main content

babel-plugin-minify-numeric-literals

Example

In

JavaScript
[1000, -20000]

Out

JavaScript
[1e3, -2e4]

Installation

npm install babel-plugin-minify-numeric-literals --save-dev

Usage

babel.config.json
{
"plugins": ["minify-numeric-literals"]
}

Via CLI

Shell
babel --plugins minify-numeric-literals script.js

Via Node API

JavaScript
require("@babel/core").transformSync("code", {
plugins: ["minify-numeric-literals"]
});