babel-plugin-transform-es5-property-mutators

6.24.1 • Public • Published

babel-plugin-transform-es5-property-mutators

This plugin allows Babel to transform 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 --save-dev babel-plugin-transform-es5-property-mutators

Usage

Via .babelrc (Recommended)

.babelrc

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

Via CLI

babel --plugins transform-es5-property-mutators script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-es5-property-mutators"]
});

Readme

Keywords

Package Sidebar

Install

npm i babel-plugin-transform-es5-property-mutators

Weekly Downloads

5,777

Version

6.24.1

License

MIT

Last publish

Collaborators

  • hzoo
  • loganfsmyth
  • existentialism