ClassX
Basic module that provide Backbone like extend with _super functionality. Also mixins.
- extend - you can extend any of your class
- _super - easy invoke parent's methods
- mixins - mix any object to your class
Usage
Extend
/** * @class Note * @extends ClassX */var Note = ClassX; /** * @class PrivateNote * @extends Note */var PrivateNote = Note; var note = dateCreation: 1991; // This note was created ...var secretNote = ; // This note was created ... No one can see this.
Mixins
Mixins are common objects that you can mix into any of your class.
/** * @mixin WithEncryption */var WithEncryption = { console; } /** * @class ClassWithEncryption * @mixes WithEncryption */var ClassWithEncryption = ClassX; var instance = ; // encrypted!
Install
npm install objectx
Run tests
mocha --reporter spec