Skip to content

Preserve whether an object property is quoted in mozilla-ast.js #3323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
preserve whether an object property is quoted in mozilla-ast.js
  • Loading branch information
kripken committed Jan 31, 2019
commit 452e9751eebccd43bc2111f3e835b075aa285262
7 changes: 6 additions & 1 deletion lib/mozilla-ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@
end : my_end_token(M),
properties : M.properties.map(function(prop) {
prop.type = "Property";
return from_moz(prop)
var ret = from_moz(prop);
if (prop.key.type === "Literal" &&
(prop.key.raw[0] === '"' || prop.key.raw[0] === "'")) {
ret.quote = true;
}
return ret;
})
});
},
Expand Down