Babel plugin to remove decorators from es7 code.
MIT License
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, by removing the decorator line before the transpilation.
Turns this:
function classDec (){};
function methodDec (){};
@classDec
class DecoratedClass {
@methodFoo(true)
method() { }
}
into this:
function classDec (){};
function methodDec (){};
class DecoratedClass {
method() { }
}
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": ["remove-decorators:before"]
}
$ npm test