Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

es-decorate

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es-decorate

ES7 decorators for CoffeeScript

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
79
Maintainers
1
Weekly downloads
 
Created
Source

es-decorate

ES7 decorators for CoffeeScript

Why

Libraries such as Angular and Aurelia are starting to use decorators according to the API proposed in https://github.com/wycats/javascript-decorators which is supported in Babel 5+ and TypeScript 1.5

On the other hand, it seems CoffeeScript won't be adding decorators any time soon:

es-decorate fills the syntactic gap providing a helper function that can apply decorators compliant with the proposed decorator API.

Install

npm install --save es-decorate

Usage

Following the examples in https://github.com/wycats/javascript-decorators:

decorate = require 'es-decorate'

# Class decorator must be assigned to variable or property.
Foo = decorate F('color'), G, class #  Class name is optional in CoffeeScript

  # Method with redundant name
  bar: decorate 'bar', @, F('color'), G, ->

  # Or just...
  decorate 'baz', @, F('color'), G, ->
  #  ...if no code analyzer will miss the explicit method declaration

Multiline declaration:

Foo = decorate [
  F 'color'
  G
  H
  I 123
  J
  ], class Foo

Less dumb example, using Angular 2:

decorate = require 'es-decorate'
{Component, View} = require 'angular2/angular2'

AppComponent = decorate [
  Component selector: 'my-app'
  View template: '<h1>My first Angular 2 App</h1>'
], class AppComponent
  constructor: ->

Keywords

FAQs

Package last updated on 27 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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