babel-plugin-transform-bigint
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -210,5 +210,2 @@ // see https://github.com/babel/babel/pull/6015 | ||
var maybeJSBI = { | ||
BigInt: function BigInt(a) { | ||
return JSBI.BigInt(a); | ||
}, | ||
toNumber: function toNumber(a) { | ||
@@ -291,2 +288,8 @@ return typeof a === "object" ? JSBI.toNumber(a) : Number(a); | ||
} | ||
if (path.node.callee.type === 'MemberExpression' && | ||
path.node.callee.object.type === 'Identifier' && | ||
path.node.callee.object.name === 'BigInt' && | ||
path.node.callee.property.name === 'asUintN') { | ||
path.replaceWith(types.callExpression(types.memberExpression(types.identifier(JSBI), types.identifier('asUintN')), path.node.arguments)); | ||
} | ||
}, | ||
@@ -293,0 +296,0 @@ BigIntLiteral: function (path, state) { |
{ | ||
"name": "babel-plugin-transform-bigint", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "A plugin for babel to transform `x * y` into something like `JSBI.multiply(x, y)` to support bigints.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
24
tests.js
@@ -1,2 +0,2 @@ | ||
// to run the test use a command: `npx babel --plugins=./index.js tests.js` | ||
// to run the test use a command: `npx babel --plugins=module:./index.js tests.js` | ||
@@ -36,1 +36,23 @@ o.x.y += b; | ||
*/ | ||
var g1 = 1; | ||
g1 = 1n; | ||
if (g1 === 1n) { | ||
console.log(g1); | ||
} | ||
var g2 = 1n; | ||
if (g2 == 1) { | ||
console.log(g2); | ||
} | ||
var g3 = 1n; | ||
if (g3 < 1) { | ||
console.log(g3); | ||
} | ||
var g4 = 1n; | ||
BigInt.asUintN(10, g4) |
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
32643
626