Favour extends helper over objectWithoutProperties when whole object gets copied anyway (#7390)

This commit is contained in:
Mateusz Burzyński
2018-03-14 22:59:02 +01:00
committed by GitHub
parent 07ab02f6b2
commit d682e32529
18 changed files with 142 additions and 37 deletions

View File

@@ -0,0 +1,7 @@
var z = {};
var { ...x } = z;
var { x, ...y } = z;
var { [x]: x, ...y } = z;
(function({ x, ...y }) { });
({ x, y, ...z } = o);

View File

@@ -0,0 +1,11 @@
{
"plugins": [
"external-helpers",
["transform-destructuring", { "useBuiltIns": true }],
"transform-spread",
"transform-parameters",
"transform-block-scoping",
"proposal-object-rest-spread",
"transform-regenerator"
]
}

View File

@@ -0,0 +1,20 @@
var z = {};
var _z = z,
x = Object.assign({}, _z);
var _z2 = z,
x = _z2.x,
y = babelHelpers.objectWithoutProperties(_z2, ["x"]);
var _z3 = z,
x = _z3[x],
y = babelHelpers.objectWithoutProperties(_z3, [x]);
(function (_ref) {
var x = _ref.x,
y = babelHelpers.objectWithoutProperties(_ref, ["x"]);
});
var _o = o;
x = _o.x;
y = _o.y;
z = babelHelpers.objectWithoutProperties(_o, ["x", "y"]);
_o;

View File

@@ -1,6 +1,6 @@
var z = {};
var _z = z,
x = babelHelpers.objectWithoutProperties(_z, []);
x = babelHelpers.extends({}, _z);
var _z2 = z,
x = _z2.x,
y = babelHelpers.objectWithoutProperties(_z2, ["x"]);