@babel/plugin-transform-property-mutators

Example

In

  1. var foo = {
  2. get bar() {
  3. return this._bar;
  4. },
  5. set bar(value) {
  6. this._bar = value;
  7. }
  8. };

Out

  1. var foo = Object.defineProperties({}, {
  2. bar: {
  3. get: function () {
  4. return this._bar;
  5. },
  6. set: function (value) {
  7. this._bar = value;
  8. },
  9. configurable: true,
  10. enumerable: true
  11. }
  12. });

Installation

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

Usage

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

Via CLI

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

Via Node API

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