Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly transform spreads of arrays with holes (#13439)
* Correctly transform spreads of arrays with holes * Use `arrayWithoutHoles` helper * Add exec test * Update for Babel 8 Co-authored-by: phapp88 <phapp1988@gmail.com>
- Loading branch information
1 parent
366e6d9
commit e914d12
Showing
9 changed files
with
38 additions
and
3 deletions.
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
2 changes: 2 additions & 0 deletions
2
...babel-plugin-transform-spread/test/fixtures/spread/nested-array-with-hole-babel-7/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,2 @@ | ||
let arr = ['a', ...['b',,'c']]; | ||
expect(2 in arr).toBe(true); |
2 changes: 2 additions & 0 deletions
2
...abel-plugin-transform-spread/test/fixtures/spread/nested-array-with-hole-babel-7/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,2 @@ | ||
var a = [...['a',, 'b']]; | ||
var b = ['a', ...['b',, 'c']]; |
3 changes: 3 additions & 0 deletions
3
...-plugin-transform-spread/test/fixtures/spread/nested-array-with-hole-babel-7/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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"BABEL_8_BREAKING": false | ||
} |
2 changes: 2 additions & 0 deletions
2
...bel-plugin-transform-spread/test/fixtures/spread/nested-array-with-hole-babel-7/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,2 @@ | ||
var a = babelHelpers.arrayWithoutHoles(['a',, 'b']); | ||
var b = ['a'].concat(babelHelpers.arrayWithoutHoles(['b',, 'c'])); |
2 changes: 2 additions & 0 deletions
2
packages/babel-plugin-transform-spread/test/fixtures/spread/nested-array-with-hole/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,2 @@ | ||
let arr = ['a', ...['b',,'c']]; | ||
expect(2 in arr).toBe(true); |
2 changes: 2 additions & 0 deletions
2
packages/babel-plugin-transform-spread/test/fixtures/spread/nested-array-with-hole/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,2 @@ | ||
var a = [...['a',, 'b']]; | ||
var b = ['a', ...['b',, 'c']]; |
3 changes: 3 additions & 0 deletions
3
...es/babel-plugin-transform-spread/test/fixtures/spread/nested-array-with-hole/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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"BABEL_8_BREAKING": true | ||
} |
2 changes: 2 additions & 0 deletions
2
packages/babel-plugin-transform-spread/test/fixtures/spread/nested-array-with-hole/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,2 @@ | ||
var a = babelHelpers.arrayLikeToArray(['a',, 'b']); | ||
var b = ['a'].concat(babelHelpers.arrayLikeToArray(['b',, 'c'])); |