A collection of some common decorators for javascript as described by wycats/javascript-decorators.
Install with JSPM
jspm install js-deco
Install with Bower
bower install js-deco
Install with NPM
npm install js-deco
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(){
}
}
Have a look at the unit tests for more detailed examples.
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.