babel-plugin-transform-shorthand-instance-expressions
v0.0.1
Published
Babel plugin to enable shorthand instance expressions (similar to @ in CoffeeScript).
Downloads
6
Maintainers
Readme
babel-plugin-transform-shorthand-instance-expressions
Babel plugin to enable shorthand instance expressions (similar to @
in CoffeeScript).
This is an advanced plugin that requires Babby to work, not regular Babel.
It transforms code like this:
class Logger {
constructor(message) {
#message = message;
#logMessage();
}
logMessage() {
console.log(#message);
}
}
...into this:
class Logger {
constructor(message) {
this.message = message;
this.logMessage();
}
logMessage() {
console.log(this.message);
}
}
Installation
Install the package with NPM:
$ npm install babel-plugin-transform-shorthand-instance-expressions
Usage
Add the following line to your .babelrc
file:
{
"plugins": ["transform-shorthand-instance-expressions"]
}