Socket
Socket
Sign inDemoInstall

@babel/plugin-proposal-optional-chaining

Package Overview
Dependencies
Maintainers
6
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-proposal-optional-chaining - npm Package Compare versions

Comparing version 7.11.0 to 7.12.0

26

lib/index.js

@@ -29,2 +29,23 @@ "use strict";

function needsMemoize(path) {
let optionalPath = path;
const {
scope
} = path;
while (optionalPath.isOptionalMemberExpression() || optionalPath.isOptionalCallExpression()) {
const {
node
} = optionalPath;
const childKey = optionalPath.isOptionalMemberExpression() ? "object" : "callee";
const childPath = (0, _helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers)(optionalPath.get(childKey));
if (node.optional) {
return !scope.isStatic(childPath.node);
}
optionalPath = childPath;
}
}
return {

@@ -50,2 +71,7 @@ name: "proposal-optional-chaining",

if (scope.path.isPattern() && needsMemoize(optionalPath)) {
path.replaceWith(_core.template.ast`(() => ${path.node})()`);
return;
}
while (optionalPath.isOptionalMemberExpression() || optionalPath.isOptionalCallExpression()) {

@@ -52,0 +78,0 @@ const {

6

package.json
{
"name": "@babel/plugin-proposal-optional-chaining",
"version": "7.11.0",
"version": "7.12.0",
"description": "Transform optional chaining operators into a series of nil checks",

@@ -27,6 +27,6 @@ "repository": {

"devDependencies": {
"@babel/core": "^7.11.0",
"@babel/core": "^7.12.0",
"@babel/helper-plugin-test-runner": "^7.10.4",
"@babel/plugin-transform-block-scoping": "^7.10.4"
}
}
}
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