Socket
Socket
Sign inDemoInstall

babel-plugin-transform-decorators

Package Overview
Dependencies
Maintainers
6
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-decorators - npm Package Compare versions

Comparing version 6.13.0 to 6.22.0

13

package.json
{
"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)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc