Socket
Socket
Sign inDemoInstall

babel-plugin-transform-bigint

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-bigint - npm Package Compare versions

Comparing version 1.0.13 to 1.0.14

12

__tests__/index-test.js

@@ -151,1 +151,13 @@ // to run this test file use `npx jest` in the parent folder or `npm run test`

});
it('it does not mutable variables', function () {
const example = `
function f() {
for (let i = 0; i < 10; i += 1) {
console.log(i * i);
}
}
`;
const {code} = babel.transform(example, {plugins: [plugin]});
expect(code).toMatchSnapshot();
});

19

index.js

@@ -107,8 +107,17 @@ // see https://github.com/babel/babel/pull/6015

const x = binding.path.get('init');
if (x.node != null && canBeBigInt(x) === false && binding.constant) {
return false;
if (x.node != null) {
const X = canBeBigInt(x);
if ((X === false || X === JSBI) && binding.constant) {
return X;
}
if ((X === false || X === JSBI) && !binding.constant) {
let allAssignmentsHaveSameType = true;
for (const path of binding.constantViolations) {
allAssignmentsHaveSameType = allAssignmentsHaveSameType && canBeBigInt(path) === X;
}
if (allAssignmentsHaveSameType) {
return X;
}
}
}
if (x.node != null && canBeBigInt(x) === JSBI && binding.constant) {
return JSBI;
}
}

@@ -115,0 +124,0 @@ for (const path of binding.referencePaths) {

{
"name": "babel-plugin-transform-bigint",
"version": "1.0.13",
"version": "1.0.14",
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc