Skip to content

gooy/js-deco

Repository files navigation

js-deco

GitHub version MIT License Built with gulp Built with babel

A collection of some common decorators for javascript as described by wycats/javascript-decorators.

Installation

For the browser

Install with JSPM

jspm install js-deco

Install with Bower

bower install js-deco

For node

Install with NPM

npm install js-deco

Usage

The decorators can be imported as a group:

import * as deco from "js-deco";

In which case they can be used as

class Foo {

  @deco.chain
  someMethod(){
    
  }
  
}

Or the decorators can be imported separately:

import {chain,before,after,curry,condition,memoize,once} from "js-deco";

Then they can be used as

class Foo {
    
  @chain
  someMethod(){
    
  }
  
}

Decorators


Have a look at the unit tests for more detailed examples.

Running The Tests

To run the unit tests, first ensure that you have followed the steps above in order to install all dependencies and successfully build the library. Once you have done that, proceed with these additional steps:

  1. Ensure that the Karma CLI is installed. If you need to install it, use the following command:

    npm install -g karma-cli
  2. Ensure that jspm is installed. If you need to install it, use the following commnand:

    npm install -g jspm
  3. Download the SystemJS module loader:

    jspm dl-loader
  4. You can now run the tests with this command:

    karma start

    Or by running the gulp task

    gulp test

We'd love for you to contribute and make this repository better !
If this interests you, please begin by reading our contributing guidelines.

About

Common javascript decorators

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •