| 
				
					 | 
			2 years ago | |
|---|---|---|
| .. | ||
| lib | 2 years ago | |
| .npmignore | 2 years ago | |
| README.md | 2 years ago | |
| package.json | 2 years ago | |
Compile class and object decorators to ES5
(examples are from proposal)
@annotation
class MyClass { }
function annotation(target) {
   target.annotated = true;
}
@isTestable(true)
class MyClass { }
function isTestable(value) {
   return function decorator(target) {
      target.isTestable = value;
   }
}
class C {
  @enumerable(false)
  method() { }
}
function enumerable(value) {
  return function (target, key, descriptor) {
     descriptor.enumerable = value;
     return descriptor;
  }
}
npm install --save-dev babel-plugin-transform-decorators
.babelrc (Recommended).babelrc
{
  "plugins": ["transform-decorators"]
}
babel --plugins transform-decorators script.js
require("babel-core").transform("code", {
  plugins: ["transform-decorators"]
});