ES5 property mutators transform

Turn object initializer mutators into Object.defineProperties.

Example

In

var foo = {
  get bar() {
    return "bar";
  }
};

Out

var foo = Object.defineProperties({}, {
  bar: {
    get: function () {
      return "bar";
    },
    enumerable: true,
    configurable: true
  }
});

Installation

$ npm install babel-plugin-transform-es5-property-mutators

Usage

Add the following line to your .babelrc file:

{
  "plugins": ["transform-es5-property-mutators"]
}