Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow patterns as argument of RestElement (#8414)
- Loading branch information
1 parent
d9149aa
commit 9eef660
Showing
4 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
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
5 changes: 5 additions & 0 deletions
5
packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-patterns/exec.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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function foo(...{ length }) { | ||
return length; | ||
} | ||
|
||
expect(foo(1, 2, 3)).toEqual(3); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-patterns/input.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
function foo(...[a]) {} |
7 changes: 7 additions & 0 deletions
7
packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-patterns/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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function foo() { | ||
for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) { | ||
_ref[_key] = arguments[_key]; | ||
} | ||
|
||
var a = _ref[0]; | ||
} |