babel/packages/babel-plugin-transform-es3-property-literals
Mauro Bringolf 2311ddbe67 Add transform to rename variables that are ES3 reserved words (#6479)
* Initial version

* Replace .includes with .indexOf and better node set to visit

* Alphabetically sort es3 reserved words and make difference helper for readability

* Fix second Array.include error that was not polyfilled

* Move es3 keywords into separate babel-types helper and use in all es3 transforms

* Reference local plugin build directly for tests

* Try relative import for babel-types

* Update to scoped package name and beta 3

* Fix unscoped package import

* Replace local plugin reference with proper plugin name
2017-10-18 15:00:58 -07:00
..
2017-03-25 21:46:16 -04:00

@babel/plugin-transform-es3-property-literals

Ensure that reserved words are quoted in object property keys

Example

In

var foo = {
  catch: function () {}
};

Out

var foo = {
  "catch": function () {}
};

Installation

npm install --save-dev @babel/plugin-transform-es3-property-literals

Usage

.babelrc

{
  "plugins": ["transform-es3-property-literals"]
}

Via CLI

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

Via Node API

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