inherits-class
v1.0.0
Published
This is es2015 library for inherits multiple 'class's function'.
Downloads
8
Maintainers
Readme
inherits-class
This is es2015 library for inherits multiple "class's function".
Install
$ npm install inherits-class
JSDoc
inherits(...clss) ⇒ Object
inherits multipule "class's function"
Kind: global function
Returns: Object - inherited class
| Param | Type | Description | | --- | --- | --- | | ...clss | Object | class or Object |
Example
class FirstClass {
first() {
return 'first func';
}
};
class SecondClass {
second() {
// For Example. Abstract this function.
throw new Error('second is not implement!');
}
};
let ThirdObj = {
third: () => {
return 'third func';
}
}
class Base extends inherits(FirstClass, SecondClass, ThirdObj) {
constructor() {
super();
}
base() {
return 'base func';
}
}
let base = new Base();
base.first(); // 'first func'
base.second(); // throws error
base.third(); // 'third func'
base.base(); // 'base func'
Development
# watch
npm run watch
# build
npm run build
# test
npm run test
Contributing
- Please Fork it!
- Create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request :D
License
MIT