babel-plugin-minify-numeric-literals

Example

In

  1. [1000, -20000]

Out

  1. [1e3, -2e4]

Installation

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

Usage

  1. {
  2. "plugins": ["minify-numeric-literals"]
  3. }

Via CLI

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

Via Node API

  1. require("@babel/core").transform("code", {
  2. plugins: ["minify-numeric-literals"]
  3. });