diff --git a/lib/6to5/transformers/property-name-shorthand.js b/lib/6to5/transformers/property-name-shorthand.js index e69de29bb2..27c303f0aa 100644 --- a/lib/6to5/transformers/property-name-shorthand.js +++ b/lib/6to5/transformers/property-name-shorthand.js @@ -0,0 +1,3 @@ +exports.Property = function (node) { + if (node.shorthand) node.shorthand = false; +}; diff --git a/test/fixtures/property-name-shorthand/mixed/actual.js b/test/fixtures/property-name-shorthand/mixed/actual.js new file mode 100644 index 0000000000..c2c49e0253 --- /dev/null +++ b/test/fixtures/property-name-shorthand/mixed/actual.js @@ -0,0 +1 @@ +var coords = { x, y, foo: "bar" }; diff --git a/test/fixtures/property-name-shorthand/mixed/expected.js b/test/fixtures/property-name-shorthand/mixed/expected.js new file mode 100644 index 0000000000..88427e8bfd --- /dev/null +++ b/test/fixtures/property-name-shorthand/mixed/expected.js @@ -0,0 +1,5 @@ +var coords = { + x: x, + y: y, + foo: "bar" +}; diff --git a/test/fixtures/property-name-shorthand/multiple/actual.js b/test/fixtures/property-name-shorthand/multiple/actual.js new file mode 100644 index 0000000000..224e1f6c7b --- /dev/null +++ b/test/fixtures/property-name-shorthand/multiple/actual.js @@ -0,0 +1 @@ +var coords = { x, y }; diff --git a/test/fixtures/property-name-shorthand/multiple/expected.js b/test/fixtures/property-name-shorthand/multiple/expected.js new file mode 100644 index 0000000000..e07257b750 --- /dev/null +++ b/test/fixtures/property-name-shorthand/multiple/expected.js @@ -0,0 +1,4 @@ +var coords = { + x: x, + y: y +}; diff --git a/test/fixtures/property-name-shorthand/single/actual.js b/test/fixtures/property-name-shorthand/single/actual.js new file mode 100644 index 0000000000..8cd0750474 --- /dev/null +++ b/test/fixtures/property-name-shorthand/single/actual.js @@ -0,0 +1 @@ +var coords = { x }; diff --git a/test/fixtures/property-name-shorthand/single/expected.js b/test/fixtures/property-name-shorthand/single/expected.js new file mode 100644 index 0000000000..9b14ab0e30 --- /dev/null +++ b/test/fixtures/property-name-shorthand/single/expected.js @@ -0,0 +1,3 @@ +var coords = { + x: x +};