babel-plugin-transform-decorators
Advanced tools
Comparing version 6.13.0 to 6.22.0
{ | ||
"name": "babel-plugin-transform-decorators", | ||
"version": "6.13.0", | ||
"version": "6.22.0", | ||
"description": "Compile class and object decorators to ES5", | ||
@@ -12,12 +12,11 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-decorators", | ||
"dependencies": { | ||
"babel-types": "^6.13.0", | ||
"babel-helper-define-map": "^6.8.0", | ||
"babel-types": "^6.22.0", | ||
"babel-plugin-syntax-decorators": "^6.13.0", | ||
"babel-helper-explode-class": "^6.8.0", | ||
"babel-template": "^6.8.0", | ||
"babel-runtime": "^6.0.0" | ||
"babel-helper-explode-class": "^6.22.0", | ||
"babel-template": "^6.22.0", | ||
"babel-runtime": "^6.22.0" | ||
}, | ||
"devDependencies": { | ||
"babel-helper-plugin-test-runner": "^6.8.0" | ||
"babel-helper-plugin-test-runner": "^6.22.0" | ||
} | ||
} |
# babel-plugin-transform-decorators | ||
Compile class and object decorators to ES5 | ||
> Compile class and object decorators to ES5 | ||
## Example | ||
(examples are from proposal) | ||
### Simple class decorator | ||
```js | ||
@annotation | ||
class MyClass { } | ||
function annotation(target) { | ||
target.annotated = true; | ||
} | ||
``` | ||
### Class decorator | ||
```js | ||
@isTestable(true) | ||
class MyClass { } | ||
function isTestable(value) { | ||
return function decorator(target) { | ||
target.isTestable = value; | ||
} | ||
} | ||
``` | ||
### Class function decorator | ||
```js | ||
class C { | ||
@enumerable(false) | ||
method() { } | ||
} | ||
function enumerable(value) { | ||
return function (target, key, descriptor) { | ||
descriptor.enumerable = value; | ||
return descriptor; | ||
} | ||
} | ||
``` | ||
## Installation | ||
```sh | ||
$ npm install babel-plugin-transform-decorators | ||
npm install --save-dev babel-plugin-transform-decorators | ||
``` | ||
@@ -26,3 +70,3 @@ | ||
```sh | ||
$ babel --plugins transform-decorators script.js | ||
babel --plugins transform-decorators script.js | ||
``` | ||
@@ -37,1 +81,5 @@ | ||
``` | ||
## References | ||
* [Proposal: Javascript Decorators](https://github.com/wycats/javascript-decorators/blob/master/README.md) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7390
5
84
- Removedbabel-helper-define-map@^6.8.0
- Removedbabel-helper-define-map@6.26.0(transitive)
- Removedbabel-helper-function-name@6.24.1(transitive)
- Removedbabel-helper-get-function-arity@6.24.1(transitive)
Updatedbabel-runtime@^6.22.0
Updatedbabel-template@^6.22.0
Updatedbabel-types@^6.22.0