babel-plugin-transform-bigint
Advanced tools
Comparing version 1.0.19 to 1.0.20
@@ -234,1 +234,13 @@ // to run this test file use `npx jest` in the parent folder or `npm run test` | ||
}); | ||
it('sometimes type of conditional expression can be determined as JSBI', function () { | ||
const example = ` | ||
function f(a) { | ||
const b = a % 3n === 0n ? 1n : 3n; | ||
return b * b; | ||
} | ||
`; | ||
const {code} = babel.transform(example, {plugins: [plugin]}); | ||
expect(code).toMatchSnapshot(); | ||
}); |
@@ -247,3 +247,5 @@ // see https://github.com/babel/babel/pull/6015 | ||
if (path.node.type === 'ConditionalExpression') { | ||
return canBeBigInt(path.get('consequent')) !== false || canBeBigInt(path.get('alternate')) !== false ? maybeJSBI : false; | ||
const a = canBeBigInt(path.get('consequent')); | ||
const b = canBeBigInt(path.get('alternate')); | ||
return a === b ? a : maybeJSBI; | ||
} | ||
@@ -250,0 +252,0 @@ if (path.node.type === 'FunctionExpression') { |
{ | ||
"name": "babel-plugin-transform-bigint", | ||
"version": "1.0.19", | ||
"version": "1.0.20", | ||
"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", |
Sorry, the diff of this file is not supported yet
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
47168
806