Consider default params for object pattern.
This commit is contained in:
parent
b608e28aa7
commit
45b41740d8
@ -310,8 +310,11 @@ export default function () {
|
||||
} else if (id.isObjectPattern()) {
|
||||
for (let i = 0; i < id.node.properties.length; i++) {
|
||||
const prop = id.node.properties[i];
|
||||
let propValue = prop.value;
|
||||
if (!t.isRestProperty(prop)) {
|
||||
const propValue = prop.value;
|
||||
if (t.isAssignmentPattern(propValue)) {
|
||||
propValue = propValue.left;
|
||||
}
|
||||
addTo(exports, propValue.name, propValue);
|
||||
exportsToInsert.push(buildExportsAssignment(propValue, propValue));
|
||||
nonHoistedExportNames[propValue.name] = true;
|
||||
|
||||
@ -0,0 +1 @@
|
||||
export const { foo, bar = 1 } = {};
|
||||
@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const { foo, bar = 1 } = {};
|
||||
exports.foo = foo;
|
||||
exports.bar = bar;
|
||||
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const { foo: bar, baz } = {};
|
||||
exports.baz = baz;
|
||||
exports.bar = bar;
|
||||
exports.baz = baz;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user