Socket
Socket
Sign inDemoInstall

@babel/types

Package Overview
Dependencies
3
Maintainers
4
Versions
154
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.23.9 to 7.24.0

24

lib/clone/cloneNode.js

@@ -9,3 +9,7 @@ "use strict";

var _index2 = require("../validators/generated/index.js");
const has = Function.call.bind(Object.prototype.hasOwnProperty);
const {
hasOwn
} = {
hasOwn: Function.call.bind(Object.prototype.hasOwnProperty)
};
function cloneIfNode(obj, deep, withoutLoc, commentsCache) {

@@ -36,13 +40,13 @@ if (obj && typeof obj.type === "string") {

newNode.name = node.name;
if (has(node, "optional") && typeof node.optional === "boolean") {
if (hasOwn(node, "optional") && typeof node.optional === "boolean") {
newNode.optional = node.optional;
}
if (has(node, "typeAnnotation")) {
if (hasOwn(node, "typeAnnotation")) {
newNode.typeAnnotation = deep ? cloneIfNodeOrArray(node.typeAnnotation, true, withoutLoc, commentsCache) : node.typeAnnotation;
}
} else if (!has(_index.NODE_FIELDS, type)) {
} else if (!hasOwn(_index.NODE_FIELDS, type)) {
throw new Error(`Unknown node type: "${type}"`);
} else {
for (const field of Object.keys(_index.NODE_FIELDS[type])) {
if (has(node, field)) {
if (hasOwn(node, field)) {
if (deep) {

@@ -56,3 +60,3 @@ newNode[field] = (0, _index2.isFile)(node) && field === "comments" ? maybeCloneComments(node.comments, deep, withoutLoc, commentsCache) : cloneIfNodeOrArray(node[field], true, withoutLoc, commentsCache);

}
if (has(node, "loc")) {
if (hasOwn(node, "loc")) {
if (withoutLoc) {

@@ -64,12 +68,12 @@ newNode.loc = null;

}
if (has(node, "leadingComments")) {
if (hasOwn(node, "leadingComments")) {
newNode.leadingComments = maybeCloneComments(node.leadingComments, deep, withoutLoc, commentsCache);
}
if (has(node, "innerComments")) {
if (hasOwn(node, "innerComments")) {
newNode.innerComments = maybeCloneComments(node.innerComments, deep, withoutLoc, commentsCache);
}
if (has(node, "trailingComments")) {
if (hasOwn(node, "trailingComments")) {
newNode.trailingComments = maybeCloneComments(node.trailingComments, deep, withoutLoc, commentsCache);
}
if (has(node, "extra")) {
if (hasOwn(node, "extra")) {
newNode.extra = Object.assign({}, node.extra);

@@ -76,0 +80,0 @@ }

@@ -20,3 +20,3 @@ "use strict";

PLACEHOLDERS_ALIAS[type].forEach(alias => {
if (!Object.hasOwnProperty.call(PLACEHOLDERS_FLIPPED_ALIAS, alias)) {
if (!hasOwnProperty.call(PLACEHOLDERS_FLIPPED_ALIAS, alias)) {
PLACEHOLDERS_FLIPPED_ALIAS[alias] = [];

@@ -23,0 +23,0 @@ }

@@ -392,3 +392,7 @@ "use strict";

qualifier: (0, _utils.validateOptionalType)("TSEntityName"),
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation"),
options: {
validate: (0, _utils.assertNodeType)("Expression"),
optional: true
}
}

@@ -395,0 +399,0 @@ });

{
"name": "@babel/types",
"version": "7.23.9",
"version": "7.24.0",
"description": "Babel Types is a Lodash-esque utility library for AST nodes",

@@ -33,3 +33,3 @@ "author": "The Babel Team (https://babel.dev/team)",

"@babel/generator": "^7.23.6",
"@babel/parser": "^7.23.9",
"@babel/parser": "^7.24.0",
"glob": "^7.2.0"

@@ -36,0 +36,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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