print assignment pattern shorthand with matching key nicely
This commit is contained in:
parent
b36cf11ac8
commit
c45ce61550
@ -39,6 +39,12 @@ export function Property(node, print) {
|
|||||||
print(node.key);
|
print(node.key);
|
||||||
this.push("]");
|
this.push("]");
|
||||||
} else {
|
} else {
|
||||||
|
// print `({ foo: foo = 5 } = {})` as `({ foo = 5 } = {});`
|
||||||
|
if (t.isAssignmentPattern(node.value) && t.isIdentifier(node.key) && node.key.name === node.value.left.name) {
|
||||||
|
print(node.value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
print(node.key);
|
print(node.key);
|
||||||
|
|
||||||
// shorthand!
|
// shorthand!
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user