Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.18 to 1.0.19

6

__tests__/index-test.js

@@ -147,2 +147,8 @@ // to run this test file use `npx jest` in the parent folder or `npm run test`

}
function f5(a) {
if (typeof a !== 'bigint') {
void 0;
}
return a * a;
}
`;

@@ -149,0 +155,0 @@ const {code} = babel.transform(example, {plugins: [plugin]});

13

index.js

@@ -205,2 +205,11 @@ // see https://github.com/babel/babel/pull/6015

const variableName = path.node.name;
const consequent = ifStatement.get('consequent').node;
let ok = false;
if (types.isBlockStatement(consequent)) {
if (consequent.body.length === 1) {
if (types.isThrowStatement(consequent.body[0])) {
ok = true;
}
}
}
const isNotTypeOfCheck = function (node, type, variableName) {

@@ -226,6 +235,6 @@ if (node.type === 'BinaryExpression' && node.operator === '!==') {

};
if (isNotTypeOfCheck(tmp.node, 'bigint', variableName)) {
if (ok && isNotTypeOfCheck(tmp.node, 'bigint', variableName)) {
return JSBI;
}
if (isNotTypeOfCheck(tmp.node, 'number', variableName)) {
if (ok && isNotTypeOfCheck(tmp.node, 'number', variableName)) {
return false;

@@ -232,0 +241,0 @@ }

2

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