babel-plugin-remove-decorators
v0.1.1
Published
Babel plugin to remove all decorators from the code.
Downloads
5
Maintainers
Readme
babel-plugin-remove-decorators
A babel plugin that removes all decorators from the code. This is useful for testing purposes. It allows you to unit test the code that has decorators attached to it.
Example
Turns this:
function classDec (){};
function methodDec (){};
@classDec
class DecoratedClass {
@methodFoo(true)
method() { }
}
into this:
function classDec (){};
function methodDec (){};
class DecoratedClass {
method() { }
}
Usage
Install via NPM
$ npm install --save-dev babel-plugin-remove-decorators
See Babel's documentation on plugins.
! Ensure that you have ES7 decorator support enabled.
! You need to use the plugin with the before
position specifier.
.babelrc example:
{
"optional": ["es7.decorators"],
"plugins": ["babel-plugin-remove-decorator:before"]
}
Run tests
$ npm test