babel-plugin-transform-es3-getter-to-property-assignment

1.0.1 • Public • Published

babel-plugin-transform-es3-getter-to-property-assignment

This plugin transforms Object.defineProperty getter to property assignment for Babel 6.x

Example

In

const exports = {};
 
Object.defineProperty(exports, 'foo', {
  enumerable: true,
  get: function get() {
    return 'bar';
  }
});

Out

const exports = {};
 
exports['foo'] = (function() {
  return 'bar';
})();

Installation

$ npm install --save-dev babel-plugin-transform-es3-getter-to-property-assignment

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["transform-es3-getter-to-property-assignment"]
}

Via CLI

babel --plugins transform-es3-getter-to-property-assignment

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-es3-getter-to-property-assignment"]
});

Package Sidebar

Install

npm i babel-plugin-transform-es3-getter-to-property-assignment

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

6.85 kB

Total Files

11

Last publish

Collaborators

  • evan2x