babel-plugin-minify-numeric-literals
Advanced tools
Comparing version 0.3.0-alpha.37064b40 to 0.3.0-alpha.5ee3078e
@@ -10,13 +10,13 @@ "use strict"; | ||
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; | ||
@@ -23,0 +23,0 @@ if (path.node.extra.raw.length > replacement.length) { |
{ | ||
"name": "babel-plugin-minify-numeric-literals", | ||
"version": "0.3.0-alpha.37064b40", | ||
"version": "0.3.0-alpha.5ee3078e", | ||
"description": "Shortens numeric literals using scientific notation", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2120