forked from babel/babel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use toPropertyKey in the "decorate" helper
This commit also makes the "toPropertyKey" helper call @@toPrimitive when needed.
- Loading branch information
1 parent
cd81b07
commit 38397ce
Showing
14 changed files
with
47 additions
and
36 deletions.
There are no files selected for viewing
5 changes: 4 additions & 1 deletion
5
packages/babel-core/test/fixtures/transformation/misc/regression-4855/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
{ | ||
"compact": false, | ||
"presets": ["env"], | ||
"plugins": ["external-helpers", "proposal-object-rest-spread"] | ||
"plugins": [ | ||
["external-helpers", { "helperVersion": "7.1.5" }], | ||
"proposal-object-rest-spread" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
[ | ||
"external-helpers", | ||
{ | ||
"helperVersion": "7.0.2" | ||
"helperVersion": "7.1.5" | ||
} | ||
] | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
[ | ||
"external-helpers", | ||
{ | ||
"helperVersion": "7.0.2" | ||
"helperVersion": "7.1.5" | ||
} | ||
] | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
[ | ||
"external-helpers", | ||
{ | ||
"helperVersion": "7.0.2" | ||
"helperVersion": "7.1.5" | ||
} | ||
] | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
[ | ||
"external-helpers", | ||
{ | ||
"helperVersion": "7.0.2" | ||
"helperVersion": "7.1.5" | ||
} | ||
] | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
[ | ||
"external-helpers", | ||
{ | ||
"helperVersion": "7.0.2" | ||
"helperVersion": "7.1.5" | ||
} | ||
] | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...transform-destructuring/test/fixtures/destructuring/es7-object-rest-builtins/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...in-transform-destructuring/test/fixtures/destructuring/es7-object-rest-loose/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
["transform-destructuring", { "loose": true }], | ||
"proposal-object-rest-spread" | ||
"proposal-object-rest-spread", | ||
["external-helpers", { "helperVersion": "7.1.5" }] | ||
] | ||
} |
19 changes: 5 additions & 14 deletions
19
...lugin-transform-destructuring/test/fixtures/destructuring/es7-object-rest-loose/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,20 @@ | ||
function _toPropertyKey(key) { if (typeof key === "symbol") { return key; } else { return String(key); } } | ||
|
||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
|
||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
|
||
var z = {}; | ||
|
||
var _z = z, | ||
x = _extends({}, _z); | ||
|
||
x = babelHelpers.extends({}, _z); | ||
var _z2 = z, | ||
x = _z2.x, | ||
y = _objectWithoutPropertiesLoose(_z2, ["x"]); | ||
|
||
y = babelHelpers.objectWithoutPropertiesLoose(_z2, ["x"]); | ||
var _z3 = z, | ||
x = _z3[x], | ||
y = _objectWithoutPropertiesLoose(_z3, [x].map(_toPropertyKey)); | ||
y = babelHelpers.objectWithoutPropertiesLoose(_z3, [x].map(babelHelpers.toPropertyKey)); | ||
|
||
(function (_ref) { | ||
let x = _ref.x, | ||
y = _objectWithoutPropertiesLoose(_ref, ["x"]); | ||
y = babelHelpers.objectWithoutPropertiesLoose(_ref, ["x"]); | ||
}); | ||
|
||
var _o = o; | ||
x = _o.x; | ||
y = _o.y; | ||
z = _objectWithoutPropertiesLoose(_o, ["x", "y"]); | ||
z = babelHelpers.objectWithoutPropertiesLoose(_o, ["x", "y"]); | ||
_o; |
2 changes: 1 addition & 1 deletion
2
packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters