mirror of
https://github.com/wu736139669/Monkey-Test.git
synced 2026-08-07 06:37:16 +00:00
31 lines
644 B
JavaScript
31 lines
644 B
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
exports["default"] = function (_ref) {
|
|
var Plugin = _ref.Plugin;
|
|
var t = _ref.types;
|
|
|
|
return new Plugin("property-literals", {
|
|
metadata: {
|
|
group: "builtin-trailing"
|
|
},
|
|
|
|
visitor: {
|
|
Property: {
|
|
exit: function exit(node) {
|
|
var key = node.key;
|
|
if (t.isLiteral(key) && t.isValidIdentifier(key.value)) {
|
|
// "foo": "bar" -> foo: "bar"
|
|
node.key = t.identifier(key.value);
|
|
node.computed = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
};
|
|
|
|
module.exports = exports["default"]; |