Member expression literals transform

Turn valid member expression property literals into plain identifiers

Example

In

obj["foo"] = "isValid";

obj.const = "isKeyword";
obj["var"] = "isKeyword";

Out

obj.foo = "isValid";

obj["const"] = "isKeyword";
obj["var"] = "isKeyword";

Installation

npm install babel-plugin-transform-member-expression-literals

Usage

.babelrc

{
  "plugins": ["transform-member-expression-literals"]
}

Via CLI

babel --plugins transform-member-expression-literals script.js

Via Node API

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

© 2018 Sebastian McKenzie
Licensed under the MIT License.
http://babeljs.io/docs/plugins/transform-member-expression-literals/