babel-plugin-auto-assign
v0.1.0
Published
A babel plugin that automatically assigns constructor parameters to instance properties.
Downloads
4
Readme
babel-plugin-auto-assign
A babel plugin that automatically assigns constructor parameters to instance properties.
@autoAssign
class Hello {
constructor(foo, bar, baz) {
}
}
class Hello {
constructor(foo, bar, baz) {
this.foo = foo;
this.bar = bar;
this.baz = baz;
}
}
Installation
$ npm install babel-plugin-auto-assign
Usage
Via .babelrc
(Recommended)
.babelrc
{
"optional": ["es7.decorators"],
"plugins": ["auto-assign"]
}
Via CLI
$ babel --optional es7.decorators --plugins auto-assgin script.js
Via Node API
require('babel-core').transform('code', {
optional: ['es7.decorators'],
plugins: ['auto-assign']
});
License
ISC