Ensure that reserved words are quoted in object property keys
GitHub · npm · Edit this page
In
var foo = {
catch: function () {}
};
Out
var foo = {
"catch": function () {}
};
npm install --save-dev babel-plugin-transform-es3-property-literals
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-es3-property-literals"]
}
babel --plugins transform-es3-property-literals script.js
require("babel-core").transform("code", {
plugins: ["transform-es3-property-literals"]
});