Add "allowArrayLike" opt to destructuring and spread transforms (#11265)
This commit is contained in:
5
packages/babel-plugin-transform-spread/test/fixtures/allowArrayLike/simple/exec.js
vendored
Normal file
5
packages/babel-plugin-transform-spread/test/fixtures/allowArrayLike/simple/exec.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
var p2 = { 0: "b", 1: "c", 2: "d", length: 3 };
|
||||
|
||||
var arr = ["a", ...p2, "e"];
|
||||
|
||||
expect(arr).toEqual(["a", "b", "c", "d", "e"]);
|
||||
1
packages/babel-plugin-transform-spread/test/fixtures/allowArrayLike/simple/input.js
vendored
Normal file
1
packages/babel-plugin-transform-spread/test/fixtures/allowArrayLike/simple/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var arr = ["a", ...p2, "e"];
|
||||
6
packages/babel-plugin-transform-spread/test/fixtures/allowArrayLike/simple/options.json
vendored
Normal file
6
packages/babel-plugin-transform-spread/test/fixtures/allowArrayLike/simple/options.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"plugins": [
|
||||
["external-helpers", { "helperVersion": "7.100.0" }],
|
||||
["transform-spread", { "allowArrayLike": true }]
|
||||
]
|
||||
}
|
||||
1
packages/babel-plugin-transform-spread/test/fixtures/allowArrayLike/simple/output.js
vendored
Normal file
1
packages/babel-plugin-transform-spread/test/fixtures/allowArrayLike/simple/output.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var arr = ["a"].concat(babelHelpers.maybeArrayLike(babelHelpers.toConsumableArray, p2), ["e"]);
|
||||
Reference in New Issue
Block a user