Socket
Socket
Sign inDemoInstall

babel-plugin-transform-es2015-destructuring

Package Overview
Dependencies
Maintainers
6
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-es2015-destructuring - npm Package Compare versions

Comparing version 6.6.5 to 6.8.0

149

lib/index.js

@@ -1,12 +0,17 @@

/* eslint max-len: 0 */
/*istanbul ignore next*/"use strict";
"use strict";
exports.__esModule = true;
var _classCallCheck = require("babel-runtime/helpers/class-call-check")["default"];
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
exports.__esModule = true;
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
exports["default"] = function (_ref) {
var t = _ref.types;
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
var _getIterator3 = _interopRequireDefault(_getIterator2);
exports.default = function ( /*istanbul ignore next*/_ref) {
/*istanbul ignore next*/var t = _ref.types;
/**

@@ -17,6 +22,17 @@ * Test if a VariableDeclaration's declarations contains any Patterns.

function variableDeclarationHasPattern(node) {
var _arr = node.declarations;
for ( /*istanbul ignore next*/var _iterator = node.declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
/*istanbul ignore next*/
var _ref2;
for (var _i = 0; _i < _arr.length; _i++) {
var declar = _arr[_i];
if (_isArray) {
if (_i >= _iterator.length) break;
_ref2 = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref2 = _i.value;
}
var declar = _ref2;
if (t.isPattern(declar.id)) {

@@ -34,6 +50,17 @@ return true;

function hasRest(pattern) {
var _arr2 = pattern.elements;
for ( /*istanbul ignore next*/var _iterator2 = pattern.elements, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
/*istanbul ignore next*/
var _ref3;
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
var elem = _arr2[_i2];
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref3 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref3 = _i2.value;
}
var elem = _ref3;
if (t.isRestElement(elem)) {

@@ -46,3 +73,3 @@ return true;

var arrayUnpackVisitor = {
var arrayUnpackVisitor = { /*istanbul ignore next*/
ReferencedIdentifier: function ReferencedIdentifier(path, state) {

@@ -56,5 +83,6 @@ if (state.bindings[path.node.name]) {

var DestructuringTransformer = (function () {
function DestructuringTransformer(opts) {
_classCallCheck(this, DestructuringTransformer);
/*istanbul ignore next*/
var DestructuringTransformer = function () {
function /*istanbul ignore next*/DestructuringTransformer(opts) {
/*istanbul ignore next*/(0, _classCallCheck3.default)(this, DestructuringTransformer);

@@ -74,3 +102,3 @@ this.blockHoist = opts.blockHoist;

var node = undefined;
var node = /*istanbul ignore next*/void 0;

@@ -219,5 +247,17 @@ if (op) {

var _arr3 = pattern.elements;
for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
var elem = _arr3[_i3];
for ( /*istanbul ignore next*/var _iterator3 = pattern.elements, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
/*istanbul ignore next*/
var _ref4;
if (_isArray3) {
if (_i3 >= _iterator3.length) break;
_ref4 = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) break;
_ref4 = _i3.value;
}
var elem = _ref4;
// deopt on holes

@@ -230,7 +270,19 @@ if (!elem) return false;

var _arr4 = arr.elements;
for (var _i4 = 0; _i4 < _arr4.length; _i4++) {
var elem = _arr4[_i4];
for ( /*istanbul ignore next*/var _iterator4 = arr.elements, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) {
/*istanbul ignore next*/
var _ref5;
if (_isArray4) {
if (_i4 >= _iterator4.length) break;
_ref5 = _iterator4[_i4++];
} else {
_i4 = _iterator4.next();
if (_i4.done) break;
_ref5 = _i4.value;
}
var _elem = _ref5;
// deopt on spread elements
if (t.isSpreadElement(elem)) return false;
if (t.isSpreadElement(_elem)) return false;
}

@@ -299,3 +351,3 @@

var elemRef = undefined;
var elemRef = /*istanbul ignore next*/void 0;

@@ -340,6 +392,6 @@ if (t.isRestElement(elem)) {

return DestructuringTransformer;
})();
}();
return {
visitor: {
visitor: { /*istanbul ignore next*/
ExportNamedDeclaration: function ExportNamedDeclaration(path) {

@@ -352,4 +404,4 @@ var declaration = path.get("declaration");

for (var _name in path.getOuterBindingIdentifiers(path)) {
var id = t.identifier(_name);
for (var name in path.getOuterBindingIdentifiers(path)) {
var id = t.identifier(name);
specifiers.push(t.exportSpecifier(id, id));

@@ -364,7 +416,6 @@ }

},
/*istanbul ignore next*/ForXStatement: function ForXStatement(path, file) {
/*istanbul ignore next*/var node = path.node;
/*istanbul ignore next*/var scope = path.scope;
ForXStatement: function ForXStatement(path, file) {
var node = path.node;
var scope = path.scope;
var left = node.left;

@@ -410,7 +461,6 @@

},
/*istanbul ignore next*/CatchClause: function CatchClause(_ref6, file) {
/*istanbul ignore next*/var node = _ref6.node;
/*istanbul ignore next*/var scope = _ref6.scope;
CatchClause: function CatchClause(_ref2, file) {
var node = _ref2.node;
var scope = _ref2.scope;
var pattern = node.param;

@@ -434,7 +484,6 @@ if (!t.isPattern(pattern)) return;

},
/*istanbul ignore next*/AssignmentExpression: function AssignmentExpression(path, file) {
/*istanbul ignore next*/var node = path.node;
/*istanbul ignore next*/var scope = path.scope;
AssignmentExpression: function AssignmentExpression(path, file) {
var node = path.node;
var scope = path.scope;
if (!t.isPattern(node.left)) return;

@@ -451,3 +500,3 @@

var ref = undefined;
var ref = /*istanbul ignore next*/void 0;
if (path.isCompletionRecord() || !path.parentPath.isExpressionStatement()) {

@@ -471,8 +520,7 @@ ref = scope.generateUidIdentifierBasedOnNode(node.right, "ref");

},
/*istanbul ignore next*/VariableDeclaration: function VariableDeclaration(path, file) {
/*istanbul ignore next*/var node = path.node;
/*istanbul ignore next*/var scope = path.scope;
/*istanbul ignore next*/var parent = path.parent;
VariableDeclaration: function VariableDeclaration(path, file) {
var node = path.node;
var scope = path.scope;
var parent = path.parent;
if (t.isForXStatement(parent)) return;

@@ -483,3 +531,3 @@ if (!parent || !path.container) return; // i don't know why this is necessary - TODO

var nodes = [];
var declar = undefined;
var declar = /*istanbul ignore next*/void 0;

@@ -519,2 +567,5 @@ for (var i = 0; i < node.declarations.length; i++) {

module.exports = exports["default"];
/*istanbul ignore next*/
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = exports["default"]; /* eslint max-len: 0 */
{
"name": "babel-plugin-transform-es2015-destructuring",
"version": "6.6.5",
"version": "6.8.0",
"description": "Compile ES2015 destructuring to ES5",

@@ -12,7 +12,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-destructuring",

"dependencies": {
"babel-runtime": "^5.0.0"
"babel-runtime": "^6.0.0"
},
"devDependencies": {
"babel-helper-plugin-test-runner": "^6.3.13"
"babel-helper-plugin-test-runner": "^6.8.0"
}
}
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