Remove modules from source

This commit is contained in:
Federico Grandi
2019-12-14 21:58:11 +01:00
parent f118062594
commit e5272e4c09
4269 changed files with 0 additions and 1074858 deletions

View File

@@ -1,49 +0,0 @@
# babel-plugin-minify-numeric-literals
Shortening of numeric literals via scientific notation
## Example
**In**
```javascript
[1000, -20000]
```
**Out**
```javascript
[1e3, -2e4]
```
## Installation
```sh
npm install babel-plugin-minify-numeric-literals --save-dev
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["minify-numeric-literals"]
}
```
### Via CLI
```sh
babel --plugins minify-numeric-literals script.js
```
### Via Node API
```javascript
require("@babel/core").transform("code", {
plugins: ["minify-numeric-literals"]
});
```

View File

@@ -1,28 +0,0 @@
"use strict";
module.exports = function () {
return {
name: "minify-numeric-literals",
visitor: {
NumericLiteral(path) {
if (!path.node.extra) return;
const normal = path.node.value.toString().replace(/^0\./, ".");
let exponential = path.node.value.toExponential().replace(/\+/g, "");
if (exponential.indexOf(".") >= 0 && exponential.indexOf("e") >= 0) {
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/, "");
}
const replacement = normal.length > exponential.length ? exponential : normal;
if (path.node.extra.raw.length > replacement.length) {
path.node.extra.raw = replacement;
}
}
}
};
};

View File

@@ -1,51 +0,0 @@
{
"_args": [
[
"babel-plugin-minify-numeric-literals@0.4.3",
"/home/runner/work/add-and-commit/add-and-commit"
]
],
"_development": true,
"_from": "babel-plugin-minify-numeric-literals@0.4.3",
"_id": "babel-plugin-minify-numeric-literals@0.4.3",
"_inBundle": false,
"_integrity": "sha1-jk/VYcefeAEob/YOjF/Z3u6TwLw=",
"_location": "/babel-plugin-minify-numeric-literals",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-plugin-minify-numeric-literals@0.4.3",
"name": "babel-plugin-minify-numeric-literals",
"escapedName": "babel-plugin-minify-numeric-literals",
"rawSpec": "0.4.3",
"saveSpec": null,
"fetchSpec": "0.4.3"
},
"_requiredBy": [
"/babel-preset-minify"
],
"_resolved": "https://registry.npmjs.org/babel-plugin-minify-numeric-literals/-/babel-plugin-minify-numeric-literals-0.4.3.tgz",
"_spec": "0.4.3",
"_where": "/home/runner/work/add-and-commit/add-and-commit",
"author": {
"name": "kangax"
},
"bugs": {
"url": "https://github.com/babel/minify/issues"
},
"description": "Shortens numeric literals using scientific notation",
"homepage": "https://github.com/babel/minify#readme",
"keywords": [
"babel-minify",
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "babel-plugin-minify-numeric-literals",
"repository": {
"type": "git",
"url": "https://github.com/babel/minify/tree/master/packages/babel-plugin-minify-numeric-literals"
},
"version": "0.4.3"
}