@babel/plugin-transform-property-literals

Example

In

  1. var foo = {
  2. // changed
  3. "bar": function () {},
  4. "1": function () {},
  5. // not changed
  6. "default": 1,
  7. [a]: 2,
  8. foo: 1
  9. };

Out

  1. var foo = {
  2. bar: function () {},
  3. 1: function () {},
  4. "default": 1,
  5. [a]: 2,
  6. foo: 1
  7. };

Installation

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

Usage

.babelrc

  1. {
  2. "plugins": ["@babel/plugin-transform-property-literals"]
  3. }

Via CLI

  1. babel --plugins @babel/plugin-transform-property-literals script.js

Via Node API

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