js-deco
v0.0.3
Published
A collection of common javascript decorators
Downloads
10
Maintainers
Readme
js-deco
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:
Ensure that the Karma CLI is installed. If you need to install it, use the following command:
npm install -g karma-cli
Ensure that jspm is installed. If you need to install it, use the following commnand:
npm install -g jspm
Download the SystemJS module loader:
jspm dl-loader
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.