A collection of ES.next decorators.
esnext-decorators
is available as an
npm package.
esnext-decorators
has been tested in a Babel 6 environment with the plugin
babel-plugin-transform-decorators-legacy
. It should also work in a Babel 5
environment set to the correct stage but is untested.
import {encapsulated, internal} from 'esnext-decorators';
@encapsulated
class Foo {
constructor() {
this.privateVariable = 42;
this.privateReadableVariable = 'foo';
this.privateWritableVariable = 'bar';
}
get exposedReadableVariable() {
return this.privateReadableVariable;
}
get exposedWritableVariable() {
return this.privateWritableVariable;
}
set exposedWritableVariable(newValue) {
this.privateWritableVariable = newValue;
}
publicMethod() {}
@internal
privateMethod() {}
}
The application requires the following external dependencies:
- Node.js
The rest of the dependencies are handled through:
npm install
Run tests with:
npm test