add initProps to single call expression in computed property names - fixes #378
This commit is contained in:
parent
223e28ba8f
commit
b5a78355c4
@ -80,7 +80,7 @@ exports.ObjectExpression = function (node, parent, file, scope) {
|
||||
var first = body[0].expression;
|
||||
|
||||
if (t.isCallExpression(first)) {
|
||||
first.arguments[0] = t.objectExpression([]);
|
||||
first.arguments[0] = t.objectExpression(initProps);
|
||||
return first;
|
||||
}
|
||||
}
|
||||
|
||||
4
test/fixtures/transformation/es6-computed-property-names/two/actual.js
vendored
Normal file
4
test/fixtures/transformation/es6-computed-property-names/two/actual.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
var obj = {
|
||||
first: "first",
|
||||
["second"]: "second",
|
||||
};
|
||||
13
test/fixtures/transformation/es6-computed-property-names/two/expected.js
vendored
Normal file
13
test/fixtures/transformation/es6-computed-property-names/two/expected.js
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
var _defineProperty = function (obj, key, value) {
|
||||
return Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
};
|
||||
|
||||
var obj = _defineProperty({
|
||||
first: "first" }, "second", "second");
|
||||
Loading…
x
Reference in New Issue
Block a user