ES3 property literals transform

Ensure that reserved words are quoted in object property keys

示例

输入

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"]
}

通过 CLI

babel --plugins transform-es3-property-literals script.js

通过 Node API

require("babel-core").transform("code", {
  plugins: ["transform-es3-property-literals"]
});