Socket
Socket
Sign inDemoInstall

@babel/types

Package Overview
Dependencies
3
Maintainers
6
Versions
160
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.0.0-beta.38 to 7.0.0-beta.39

lib/clone/cloneNode.js

12

lib/clone/clone.js

@@ -6,10 +6,8 @@ "use strict";

var _cloneNode = _interopRequireDefault(require("./cloneNode"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function clone(node) {
if (!node) return node;
var newNode = {};
Object.keys(node).forEach(function (key) {
if (key[0] === "_") return;
newNode[key] = node[key];
});
return newNode;
return (0, _cloneNode.default)(node, false);
}

@@ -6,20 +6,8 @@ "use strict";

function cloneDeep(node) {
if (!node) return node;
var newNode = {};
Object.keys(node).forEach(function (key) {
if (key[0] === "_") return;
var val = node[key];
var _cloneNode = _interopRequireDefault(require("./cloneNode"));
if (val) {
if (val.type) {
val = cloneDeep(val);
} else if (Array.isArray(val)) {
val = val.map(cloneDeep);
}
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
newNode[key] = val;
});
return newNode;
function cloneDeep(node) {
return (0, _cloneNode.default)(node);
}

@@ -12,2 +12,4 @@ "use strict";

var _cloneNode = _interopRequireDefault(require("../clone/cloneNode"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -49,3 +51,3 @@

kind: _node.kind,
id: bindings[key]
id: (0, _cloneNode.default)(bindings[key])
});

@@ -52,0 +54,0 @@ }

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

var _cloneDeep = _interopRequireDefault(require("../clone/cloneDeep"));
var _cloneNode = _interopRequireDefault(require("../clone/cloneNode"));

@@ -29,3 +29,3 @@ var _removePropertiesDeep = _interopRequireDefault(require("../modifications/removePropertiesDeep"));

} else {
alias = JSON.stringify((0, _removePropertiesDeep.default)((0, _cloneDeep.default)(key)));
alias = JSON.stringify((0, _removePropertiesDeep.default)((0, _cloneNode.default)(key)));
}

@@ -32,0 +32,0 @@

@@ -8,2 +8,3 @@ "use strict";

createUnionTypeAnnotation: true,
cloneNode: true,
clone: true,

@@ -59,3 +60,3 @@ cloneDeep: true,

};
exports.react = exports.buildMatchMemberExpression = exports.validate = exports.matchesPattern = exports.isVar = exports.isValidIdentifier = exports.isValidES3Identifier = exports.isType = exports.isSpecifierDefault = exports.isScope = exports.isReferenced = exports.isNodesEquivalent = exports.isNode = exports.isLet = exports.isImmutable = exports.isBlockScoped = exports.isBinding = exports.is = exports.shallowEqual = exports.traverseFast = exports.traverse = exports.getOuterBindingIdentifiers = exports.getBindingIdentifiers = exports.removeTypeDuplicates = exports.removePropertiesDeep = exports.removeProperties = exports.prependToMemberExpression = exports.inherits = exports.appendToMemberExpression = exports.valueToNode = exports.toStatement = exports.toSequenceExpression = exports.toKeyAlias = exports.toIdentifier = exports.toExpression = exports.toComputedKey = exports.toBlock = exports.toBindingIdentifierName = exports.ensureBlock = exports.removeComments = exports.inheritTrailingComments = exports.inheritsComments = exports.inheritLeadingComments = exports.inheritInnerComments = exports.addComments = exports.addComment = exports.cloneWithoutLoc = exports.cloneDeep = exports.clone = exports.createUnionTypeAnnotation = exports.createTypeAnnotationBasedOnTypeof = exports.assertNode = void 0;
exports.react = exports.buildMatchMemberExpression = exports.validate = exports.matchesPattern = exports.isVar = exports.isValidIdentifier = exports.isValidES3Identifier = exports.isType = exports.isSpecifierDefault = exports.isScope = exports.isReferenced = exports.isNodesEquivalent = exports.isNode = exports.isLet = exports.isImmutable = exports.isBlockScoped = exports.isBinding = exports.is = exports.shallowEqual = exports.traverseFast = exports.traverse = exports.getOuterBindingIdentifiers = exports.getBindingIdentifiers = exports.removeTypeDuplicates = exports.removePropertiesDeep = exports.removeProperties = exports.prependToMemberExpression = exports.inherits = exports.appendToMemberExpression = exports.valueToNode = exports.toStatement = exports.toSequenceExpression = exports.toKeyAlias = exports.toIdentifier = exports.toExpression = exports.toComputedKey = exports.toBlock = exports.toBindingIdentifierName = exports.ensureBlock = exports.removeComments = exports.inheritTrailingComments = exports.inheritsComments = exports.inheritLeadingComments = exports.inheritInnerComments = exports.addComments = exports.addComment = exports.cloneWithoutLoc = exports.cloneDeep = exports.clone = exports.cloneNode = exports.createUnionTypeAnnotation = exports.createTypeAnnotationBasedOnTypeof = exports.assertNode = void 0;

@@ -96,2 +97,6 @@ var _isReactComponent = _interopRequireDefault(require("./validators/react/isReactComponent"));

var _cloneNode = _interopRequireDefault(require("./clone/cloneNode"));
exports.cloneNode = _cloneNode.default;
var _clone = _interopRequireDefault(require("./clone/clone"));

@@ -98,0 +103,0 @@

{
"name": "@babel/types",
"version": "7.0.0-beta.38",
"version": "7.0.0-beta.39",
"description": "Babel Types is a Lodash-esque utility library for AST nodes",

@@ -17,5 +17,5 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>",

"devDependencies": {
"@babel/generator": "7.0.0-beta.38",
"babylon": "7.0.0-beta.38"
"@babel/generator": "7.0.0-beta.39",
"babylon": "7.0.0-beta.39"
}
}

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