Add "allowArrayLike" opt to destructuring and spread transforms (#11265)
This commit is contained in:
@@ -4,13 +4,13 @@ import { types as t } from "@babel/core";
|
||||
export default declare((api, options) => {
|
||||
api.assertVersion(7);
|
||||
|
||||
const { loose } = options;
|
||||
const { loose, allowArrayLike } = options;
|
||||
|
||||
function getSpreadLiteral(spread, scope) {
|
||||
if (loose && !t.isIdentifier(spread.argument, { name: "arguments" })) {
|
||||
return spread.argument;
|
||||
} else {
|
||||
return scope.toArray(spread.argument, true);
|
||||
return scope.toArray(spread.argument, true, allowArrayLike);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user