mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-20 23:05:09 +00:00
25 lines
No EOL
625 B
JavaScript
25 lines
No EOL
625 B
JavaScript
"use strict";
|
|
|
|
module.exports = function (_ref) {
|
|
var t = _ref.types;
|
|
|
|
return {
|
|
name: "minify-numeric-literals",
|
|
visitor: {
|
|
NumericLiteral: function NumericLiteral(path) {
|
|
if (!path.node.extra) return;
|
|
|
|
var exponential = path.node.value.toExponential().replace(/\+/g, "").replace(/e0/, "");
|
|
|
|
if (path.node.extra.raw.length > exponential.length) {
|
|
var literal = t.numericLiteral(path.node.value);
|
|
literal.extra = {
|
|
raw: exponential,
|
|
rawValue: path.node.value
|
|
};
|
|
path.replaceWith(literal);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
}; |