Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-minify-numeric-literals

Package Overview
Dependencies
Maintainers
5
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-minify-numeric-literals - npm Package Compare versions

Comparing version 0.5.0-alpha.7b176463 to 0.5.0-alpha.b4285271

12

lib/index.js

@@ -9,13 +9,13 @@ "use strict";

if (!path.node.extra) return;
var normal = path.node.value.toString().replace(/^0\./, ".");
var exponential = path.node.value.toExponential().replace(/\+/g, "");
const normal = path.node.value.toString().replace(/^0\./, ".");
let exponential = path.node.value.toExponential().replace(/\+/g, "");
if (exponential.indexOf(".") >= 0 && exponential.indexOf("e") >= 0) {
var lastChar = exponential.substr(exponential.lastIndexOf("e") + 1);
var dotIndex = exponential.lastIndexOf(".") + 1;
var subLength = exponential.substr(dotIndex, exponential.lastIndexOf("e") - dotIndex).length;
const lastChar = exponential.substr(exponential.lastIndexOf("e") + 1);
const dotIndex = exponential.lastIndexOf(".") + 1;
const subLength = exponential.substr(dotIndex, exponential.lastIndexOf("e") - dotIndex).length;
exponential = (exponential.substr(0, exponential.lastIndexOf("e") + 1) + (lastChar - subLength)).replace(".", "").replace(/e0/, "");
}
var replacement = normal.length > exponential.length ? exponential : normal;
const replacement = normal.length > exponential.length ? exponential : normal;

@@ -22,0 +22,0 @@ if (path.node.extra.raw.length > replacement.length) {

{
"name": "babel-plugin-minify-numeric-literals",
"version": "0.5.0-alpha.7b176463",
"version": "0.5.0-alpha.b4285271",
"description": "Shortens numeric literals using scientific notation",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc