babel-plugin-transform-bigint
Advanced tools
Comparing version 1.0.11 to 1.0.12
{ | ||
"name": "babel-plugin-transform-bigint", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "A plugin for babel to transform `x * y` into something like `JSBI.multiply(x, y)` to support bigints.", | ||
@@ -12,10 +12,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"@babel/plugin-syntax-bigint": "^7.8.3", | ||
"big-integer": "^1.6.48" | ||
"@babel/plugin-syntax-bigint": "^7.8.3" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.12.10", | ||
"@babel/core": "^7.12.10", | ||
"jest": "^27.0.6" | ||
}, | ||
"keywords": [ | ||
@@ -33,3 +27,8 @@ "babel-plugin", | ||
"url": "git+https://github.com/Yaffle/babel-plugin-transform-bigint.git" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.14.8", | ||
"@babel/core": "^7.14.8", | ||
"jest": "^27.0.6" | ||
} | ||
} |
@@ -81,3 +81,4 @@ # babel-plugin-transform-bigint | ||
1. Create a file test.js: | ||
1. Create a folder "example". | ||
2. Create a file test.js: | ||
```javascript | ||
@@ -126,10 +127,19 @@ // floor(log2(n)), n >= 1 | ||
2. Use babel: | ||
3. Use babel: | ||
```sh | ||
npm init | ||
npm install --save https://github.com/Yaffle/babel-plugin-transform-bigint | ||
npm install --save-dev @babel/core @babel/cli | ||
npm install jsbi --save | ||
npm install --global http-server | ||
npx babel --plugins=babel-plugin-transform-bigint test.js > test-transformed.js | ||
http-server -p 8081 | ||
``` | ||
3. create a file `test.html`. | ||
4. Comment out the next line in test-transformed.js: | ||
```javascript | ||
import JSBI from "./jsbi.mjs"; | ||
``` | ||
5. Create a file `test.html`. | ||
```html | ||
@@ -140,4 +150,3 @@ <!DOCTYPE html> | ||
<meta charset="utf-8" /> | ||
<script src="node_modules/big-integer/BigInteger.js"></script> | ||
<script src="node_modules/babel-plugin-transform-bigint/runtime.js"></script> | ||
<script src="./node_modules/jsbi/dist/jsbi-umd.js"></script> | ||
<script src="test-transformed.js"></script> | ||
@@ -147,12 +156,10 @@ <script> | ||
const form = document.querySelector("form"); | ||
const update = function () { | ||
form.oninput = function () { | ||
const value = form.value.value; | ||
const digits = Number(form.digits.value); | ||
const s = squareRoot(value, digits); | ||
form.output.value = '√' + value + ' ≈ ' + s.slice(0, 0 - digits - 1) + '.' + s.slice(0 - digits - 1, -1) + '…'; | ||
// IE 11 does not support <output> element, so `form.output.value = "value";` is not working. | ||
form.querySelector("output").textContent = '√' + value + ' ≈ ' + s.slice(0, 0 - digits - 1) + '.' + s.slice(0 - digits - 1, -1) + '…'; | ||
}; | ||
form.oninput = function () { | ||
update(); | ||
}; | ||
update(); | ||
form.oninput(); | ||
}, false); | ||
@@ -184,2 +191,2 @@ </script> | ||
4. Open `test.html` in a web browser. | ||
6. Open `http://127.0.0.1:8081/test.html` in a web browser. |
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
1
188
29088
6
509
- Removedbig-integer@^1.6.48
- Removedbig-integer@1.6.52(transitive)