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.14 to 1.0.15

12

__tests__/index-test.js

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

});
it('it does not mutable variables2', function () {
const example = `
function f() {
let i = 1;
i = -i;
return i * i;
}
`;
const {code} = babel.transform(example, {plugins: [plugin]});
expect(code).toMatchSnapshot();
});

21

index.js

@@ -53,3 +53,3 @@ // see https://github.com/babel/babel/pull/6015

const visited = new Map();
let visited = new Map();
const canBeBigInt = function (path) {

@@ -101,3 +101,3 @@ if (visited.get(path) != null) {

if (path.node.type === 'AssignmentExpression') {
return and(canBeBigInt(path.get('left')), canBeBigInt(path.get('right')));
return canBeBigInt(path.get('right'));
}

@@ -122,2 +122,19 @@ if (path.node.type === 'Identifier') {

}
if (visited.get(path) === maybeJSBI) { // assume that variable type is the same
const visitedOriginal = new Map(visited.entries());
visited.set(path, X);
for (const e of visited.entries()) {
if (e[1] === maybeJSBI) {
visited.delete(e[0]);
}
}
let allAssignmentsHaveSameType = true;
for (const path of binding.constantViolations) {
allAssignmentsHaveSameType = allAssignmentsHaveSameType && canBeBigInt(path) === X;
}
if (allAssignmentsHaveSameType) {
return X;
}
visited = visitedOriginal;
}
}

@@ -124,0 +141,0 @@ }

2

package.json
{
"name": "babel-plugin-transform-bigint",
"version": "1.0.14",
"version": "1.0.15",
"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