New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-idx

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-idx - npm Package Compare versions

Comparing version

to
1.3.0

32

lib/babel-plugin-idx.js

@@ -117,15 +117,25 @@ /**

var idxVisitor = {
CallExpression: function CallExpression(path) {
var node = path.node;
if (isIdxCall(node)) {
checkIdxArguments(node.arguments);
var ternary = constructTernary(node.arguments[0], node.arguments[1].body, path.scope.generateUidIdentifier.bind(path.scope));
path.replaceWith(ternary.expression);
for (var ii = 0; ii < ternary.uids.length; ii++) {
var uid = ternary.uids[ii];
path.scope.push({ id: t.Identifier(uid) });
}
}
}
};
return {
visitor: {
CallExpression: function CallExpression(path) {
var node = path.node;
if (isIdxCall(node)) {
checkIdxArguments(node.arguments);
var ternary = constructTernary(node.arguments[0], node.arguments[1].body, path.scope.generateUidIdentifier.bind(path.scope));
path.replaceWith(ternary.expression);
for (var ii = 0; ii < ternary.uids.length; ii++) {
var uid = ternary.uids[ii];
path.scope.push({ id: t.Identifier(uid) });
}
}
Program: function Program(path) {
// We're very strict about the shape of idx. Some transforms, like
// "babel-plugin-transform-async-to-generator", will convert arrow
// functions inside async functions into regular functions. So we do
// our transformation before any one else interferes.
path.traverse(idxVisitor);
}

@@ -132,0 +142,0 @@ }

{
"name": "babel-plugin-idx",
"version": "1.1.0",
"version": "1.3.0",
"description": "Babel plugin for transforming the idx utility function.",

@@ -20,2 +20,3 @@ "main": "lib/babel-plugin-idx.js",

"babel-jest": "^19.0.0",
"babel-plugin-transform-async-to-generator": "^6.22.0",
"babel-plugin-transform-flow-strip-types": "^6.22.0",

@@ -22,0 +23,0 @@ "babel-preset-env": "^1.1.11",