输入
var foo = {
catch: function () {}
};
输出
var foo = {
"catch": function () {}
};
npm install --save-dev babel-plugin-transform-es3-property-literals
.babelrc
(推荐).babelrc
{
"plugins": ["transform-es3-property-literals"]
}
babel --plugins transform-es3-property-literals script.js
require("babel-core").transform("code", {
plugins: ["transform-es3-property-literals"]
});