Socket
Socket
Sign inDemoInstall

@babel/plugin-proposal-nullish-coalescing-operator

Package Overview
Dependencies
55
Maintainers
4
Versions
59
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.21.4-esm.3 to 7.21.4-esm.4

lib/package.json

27

lib/index.js

@@ -1,11 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _pluginSyntaxNullishCoalescingOperator = require("@babel/plugin-syntax-nullish-coalescing-operator");
var _core = require("@babel/core");
var _default = (0, _helperPluginUtils.declare)((api, {
import { declare } from "@babel/helper-plugin-utils";
import syntaxNullishCoalescingOperator from "@babel/plugin-syntax-nullish-coalescing-operator";
import { types as t, template } from "@babel/core";
export default declare((api, {
loose = false

@@ -18,3 +12,3 @@ }) => {

name: "proposal-nullish-coalescing-operator",
inherits: _pluginSyntaxNullishCoalescingOperator.default,
inherits: syntaxNullishCoalescingOperator.default,
visitor: {

@@ -33,5 +27,5 @@ LogicalExpression(path) {

ref = node.left;
assignment = _core.types.cloneNode(node.left);
assignment = t.cloneNode(node.left);
} else if (scope.path.isPattern()) {
path.replaceWith(_core.template.statement.ast`(() => ${path.node})()`);
path.replaceWith(template.statement.ast`(() => ${path.node})()`);
return;

@@ -41,7 +35,7 @@ } else {

scope.push({
id: _core.types.cloneNode(ref)
id: t.cloneNode(ref)
});
assignment = _core.types.assignmentExpression("=", ref, node.left);
assignment = t.assignmentExpression("=", ref, node.left);
}
path.replaceWith(_core.types.conditionalExpression(noDocumentAll ? _core.types.binaryExpression("!=", assignment, _core.types.nullLiteral()) : _core.types.logicalExpression("&&", _core.types.binaryExpression("!==", assignment, _core.types.nullLiteral()), _core.types.binaryExpression("!==", _core.types.cloneNode(ref), scope.buildUndefinedNode())), _core.types.cloneNode(ref), node.right));
path.replaceWith(t.conditionalExpression(noDocumentAll ? t.binaryExpression("!=", assignment, t.nullLiteral()) : t.logicalExpression("&&", t.binaryExpression("!==", assignment, t.nullLiteral()), t.binaryExpression("!==", t.cloneNode(ref), scope.buildUndefinedNode())), t.cloneNode(ref), node.right));
}

@@ -51,4 +45,3 @@ }

});
exports.default = _default;
//# sourceMappingURL=index.js.map
{
"name": "@babel/plugin-proposal-nullish-coalescing-operator",
"version": "7.21.4-esm.3",
"version": "7.21.4-esm.4",
"description": "Remove nullish coalescing operator",

@@ -20,3 +20,3 @@ "repository": {

"dependencies": {
"@babel/helper-plugin-utils": "7.21.4-esm.3",
"@babel/helper-plugin-utils": "7.21.4-esm.4",
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3"

@@ -28,4 +28,4 @@ },

"devDependencies": {
"@babel/core": "7.21.4-esm.3",
"@babel/helper-plugin-test-runner": "7.21.4-esm.3"
"@babel/core": "7.21.4-esm.4",
"@babel/helper-plugin-test-runner": "7.21.4-esm.4"
},

@@ -32,0 +32,0 @@ "engines": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc