babel-plugin-transform-es5-property-mutators
v6.24.1
Published
Compile ES5 property mutator shorthand syntax to Object.defineProperty
Downloads
59,991
Keywords
Readme
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"]
});